配置了SQL Server 日志传送后,因为备份的数据库比较多而且时间频繁所以造成SQL Server日志非常大。如下图:

 如何让Log shipping成功的备份信息不出现在SQL Server error log_SQL Server

由于我们已经有了Log shipping的监控,所以这些备份信息对于我们来说基本上没什么用处。 那有没有办法使这些信息部出现在数据库错误日志中呢? 答案是 Trace Flag3226

 

下面内容来自MSDN:

 

3226

By default, every successful backup operation adds an entry in the SQL Server error log and in the system event log. If you create very frequent log backups, these success messages accumulate quickly, resulting in huge error logs in which finding other messages is problematic.

With this trace flag, you can suppress these log entries. This is useful if you are running frequent log backups and if none of your scripts depend on those entries.

 

在我的数据库服务器上启用Trace flag3226,错误日志中成功的备份信息不再显示:

 dbcc traceon(3226,-1)

go

 backup database DBAtodisk='d:\mssql\dba.bak'---执行三次完整备份

go 3

 backup log DBAtodisk='d:\mssql\dba_log.trn'--执行四次日志备份

go 4

 sp_readerrorlog--查看SQL Server错误日志

 如何让Log shipping成功的备份信息不出现在SQL Server error log_SQL Server_02

 也可以在启动参数中添加:

 -T 3226

 如果只想影响当前的会话使用下面的命令:

 DBCC TRACEON(3226)