编程/CLI 方式来区分 MSSQL 差异备份和完整备份?
有没有一种简单的方法可以仅通过 .bak 文件中存在的元数据来区分完整备份和差异备份?我一直在使用 osql/sqlcmd 和这样的命令作为测试:
sqlcmd -Q "RESTORE FILELISTONLY FROM DISK = 'C:\some_path\some_backup.bak'"
运行,但 DifferentialBaseLSN两种类型的备份中的数据文件都存在 DifferentialBaseGUID 信息 =(。每个备份只有三个文件,一个 .mdf、一个 .ndf 和我希望在完整数据库备份中看到这些属性的空值或零值,但是 mdf 和 ndf 文件都有这两个字段的条目
,或者是否有其他方法可以实现 。深入研究备份文件并判断它是完整的还是差异的?也许从 sql server 管理对象之类的东西中可以更容易?
Is there an easy way to tell full and differential backups apart just by the metadata present in the .bak file? I've been playing around with osql/sqlcmd and a command like this as a test:
sqlcmd -Q "RESTORE FILELISTONLY FROM DISK = 'C:\some_path\some_backup.bak'"
runs, but DifferentialBaseLSN and DifferentialBaseGUID info is present for the data files in BOTH types of backups =(. Each backup has only three files, an .mdf, an .ndf, and an .ldf. I was hoping to see null or zero values for these attributes for the full database backup, but instead the mdf and ndf files have entries for both of those fields.
Am I out of luck, or is there some other way to dig into the backup file and tell if it is full or differential? Maybe things are easier from something like sql server management objects?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 RESTORE HEADERONLY 和
BackupType
列数据库文件类型与备份类型正交
Use RESTORE HEADERONLY and the
BackupType
columnThe database file type is orthogonal to the backup type