如何判断 SQL Server 数据库是否正在备份
有没有办法以编程方式确定当前是否正在特定数据库上执行 SQL Server 备份?
我们拥有针对数据和日志文件的自动数据库备份脚本,其中数据库每晚备份一次,日志文件每 15 分钟备份一次,每天 24 小时备份一次。但是,我们认为如果日志文件备份作业与完整备份同时运行,则会失败。
我想要做的是对事务日志脚本进行更改,以便在运行完整备份时不运行事务日志备份。
是否有 DMV 或系统表可供我查询并解决这个问题?
Is there a way to programmatically determine if a SQL Server backup is currently being performd on a particular database?
We have automated database backup scripts for both data and log files, where the databases are backed up nightly and log files are backed up every 15 minutes, 24 hours a day. However, we think that the log file backup job is failing if it runs the same time as the full backup is being run.
What I'd like to do is to make a change to my transaction log script to not run a transaction log backup while the full backup is being run.
If there a DMV or a system table that I can query and work this out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,有
Yes there is
是的,这可能是 SQL 2000 中的问题。在 2005+ 中应该不是问题
请参阅 此 ServerFault 问题,因为它发生冲突。
有关更复杂的脚本,请参阅此 Serverfault 问题。
Yes, it can be a problem in SQL 2000. Should not be a problem in 2005+
See this ServerFault question for the reason it conflicts.
See this Serverfault question for a more sophisticated script.