SQL 2005 Errolog excessive treatment

1. Background

1.1 SQL database products, the database will always run after a period of time to generate no small error log, often take up a lot of space;

2, reason

Under 2.1 SQL databases By default, error logs are located in Program Files / Microsoft SQL Server / MSSQL.n / MSSQL / LOG / ERRORLOG and ERRORLOG.n file. There are 7 default retention SQL Server error log file, namely: ErrorLog, Errorlog.1 ~ Errorlog.6, the current error log (file ErrorLog) no extension. Every time when you start SQL Server instance, creates a new log errors ErrorLog, ErrorLog before and changed its name to ErrorLog.1, before ErrorLog.1 renamed ErrorLog.2, and so on, the original ErroLog.6 be deleted.

The circumstances ErrorLog file on the 2.2 production server sometimes encountered very large files, the login authentication in particular the case records to the error log

3, processing method

3.1 restart the server, using the "Start whenever SQL Server instance, creates a new log errors ErrorLog, ErrorLog before and changed its name to ErrorLog.1, before ErrorLog.1 renamed ErrorLog.2, and so" to delete previous log, this method is not recommended for large

3.2 without restarting the server, is generated by the stored procedure sp_cycle_errorlog new log file, and cycling the error log extension numbers, just as the same time to restart the service. In addition to Execute sp_cycle_errorlog, to achieve the same function you can also use the DBCC ERRORLOG. In practice, the timing may be a Job by establishing the stored procedure to execute, so the log file size control within a reasonable range.

Guess you like

Origin www.cnblogs.com/sfqas/p/12181035.html