如何在 SQL 备份附加中强制执行到期日?
如果我进行数据库备份作业,我将过期日设置为 2。每天运行一次此备份作业。如何删除超过 2 天的备份集?我使用的是 SQL 2005 Express,因此一切都作为脚本运行。这是正在运行的脚本:
BACKUP DATABASE [DatabaseName] TO DISK = N'C:\Temp\DatabaseName.bak' WITH RETAINDAYS = 2, NOFORMAT, NOINIT, NAME = N'DatabaseName-Full Database Backup', SKIP, NOREWIND, NOUNLOAD , 统计 = 10 GO
5天后我就有了5个备份集。这将填满磁盘......
谢谢
If I make a database backup job, where I set Expire day = 2. Run this backup job once every day. How can I delete backup sets that are more than 2 days old? I'm Using SQL 2005 Express, so everything runs as script. This is the script running:
BACKUP DATABASE [DatabaseName] TO DISK = N'C:\Temp\DatabaseName.bak' WITH RETAINDAYS = 2, NOFORMAT, NOINIT, NAME = N'DatabaseName-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
After 5 days I have 5 backup set. This will fill up the disk....
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Express 版无法做到这一点。它没有附带 SQL 代理作业计划服务。请参阅表格进行比较。您需要创建批处理脚本
以适应此版本或升级版本。
There is no way you can do it with Express edition. It has no SQL Agent Job Scheduling Service shipped with it. Please see table for comparison. You need to create batch script
to accommodate this or upgrade edition.
如何使用一些免费的数据库备份工具来使数据库备份在自定义日期到期?您只需将其设置在 SQL Server Express 上,它就会运行计划备份并清理旧的 *.bak
How about to use some free tools for db backup that enable db backups expire for custom dates? You just set it over the SQL Server Express and it runs scheduled backups with cleaning up old dated *.bak