是否可以在不恢复的情况下检查 .Bak 文件是否已损坏
Is it possible to check .Bak File is corrupted or not without Restoring it
我有一个 SQL 数据库的备份文件。例如 MyDB.bak。我想检查 MyDB.bak 文件是否损坏。有什么方法可以检查我的数据库备份状况是损坏还是状况良好?
注意:我不想恢复那个 .bak 文件。
谢谢
我想这就是 RESTORE VERIFYONLY
的目的。
"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. "
正如stakx所说。有关如何使用命令的信息,请参阅 link:
how to use RESTORE VERIFYONLY
检查磁盘上的备份文件
RESTORE VERIFYONLY FROM DISK = C:\AdventureWorks.BAK
GO
检查磁盘上的备份文件以查找特定备份
RESTORE VERIFYONLY FROM DISK = C:\AdventureWorks.BAK WITH FILE = 2
GO
此命令将检查此备份文件中的第二个备份。要检查备份中的内容,您可以使用 RESTORE HEADERONLY 并使用位置列指定文件编号。
我有一个 SQL 数据库的备份文件。例如 MyDB.bak。我想检查 MyDB.bak 文件是否损坏。有什么方法可以检查我的数据库备份状况是损坏还是状况良好?
注意:我不想恢复那个 .bak 文件。
谢谢
我想这就是 RESTORE VERIFYONLY
的目的。
"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. "
正如stakx所说。有关如何使用命令的信息,请参阅 link: how to use RESTORE VERIFYONLY
检查磁盘上的备份文件
RESTORE VERIFYONLY FROM DISK = C:\AdventureWorks.BAK
GO
检查磁盘上的备份文件以查找特定备份
RESTORE VERIFYONLY FROM DISK = C:\AdventureWorks.BAK WITH FILE = 2
GO
此命令将检查此备份文件中的第二个备份。要检查备份中的内容,您可以使用 RESTORE HEADERONLY 并使用位置列指定文件编号。