简体   繁体   English

SQL 服务器事务日志备份文件

[英]SQL Server Transaction Log Backup File

I am using SQL Server 2016.我正在使用 SQL 服务器 2016。

I have setup SQL Agent for Full backup (Weekly) and Transaction Log backup (Daily).我已经为完整备份(每周)和事务日志备份(每天)设置了 SQL 代理。

Backup transaction log into a single file using:使用以下命令将事务日志备份到单个文件中:

BACKUP LOG [XXX] TO  DISK = N'E:\SQLDB\Backup\XXX_Trans_Log.bak' WITH RETAINDAYS = 28, NOFORMAT, NOINIT,  NAME = N'XXX-Transaction Log Backup', NOSKIP, NOREWIND, NOUNLOAD, STATS = 10
GO

What I expected is only 28 days transaction log backups will be kept.我所期望的是只保留 28 天的事务日志备份。 But now I just found All transaction log backups are kept.但是现在我才发现所有的事务日志备份都被保留了。 So the file grows to very large in size.因此文件的大小变得非常大。

Is there syntax/option problems in the backup statement?备份语句中是否存在语法/选项问题?

Or I should have to store in separate files?或者我应该存储在单独的文件中?

What should I do now?我现在该怎么办?

retaindays does not do what you are expecting it to do. retaindays不会做你期望它做的事情。

It prevents backup files from being overwritten, but it does not mean that old backups are automatically deleted.它可以防止备份文件被覆盖,但并不意味着旧备份会被自动删除。

See here这里

If you want a solution that will do both backup and cleanup, try Ola Hallengren's solution如果您想要一个同时进行备份和清理的解决方案,请尝试Ola Hallengren 的解决方案

PS: This question is better suited to https://dba.stackexchange.com/ PS:这个问题更适合https://dba.stackexchange.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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