简体   繁体   中英

Is it possible to check .Bak File is corrupted or not without Restoring it

I have a backup file of SQL Database. For Example MyDB.bak. I want to check MyDB.bak file is corrupted or not. Is there any way to check my database backup condition either corrupted or in good condition?

Note : I dont want to restore that .bak file.

Thanks

Exactly as stakx said. See the link for how to use the command: how to use RESTORE VERIFYONLY

Check a backup file on disk

RESTORE VERIFYONLY FROM DISK = C:\AdventureWorks.BAK
GO

Check a backup file on disk for a particular backup

RESTORE VERIFYONLY FROM DISK = C:\AdventureWorks.BAK WITH FILE = 2
GO

This command will check the second backup in this backup file. To check the contents in a backup you can use RESTORE HEADERONLY and use the Position column to specify the FILE number.

I suppose that's what RESTORE VERIFYONLY is for.

"Verifies the backup but does not restore it, and checks to see that the backup set is complete and the entire backup is readable. However, RESTORE VERIFYONLY does not attempt to verify the structure of the data contained in the backup volumes. […] If the backup is valid, the SQL Server Database Engine returns a success message. "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM