:::: MENU ::::

Recycle SQL Server logs archives without restart

  • Oct 06 / 2008
  • 0
dbDigger, System Stored Procedures, T-SQL Scripts, Transaction log files

Recycle SQL Server logs archives without restart

Every time SQL Server restarts, a new error log file is created. If file count is going to be increase the maximum count specified, then oldest file is replaced by new one else just a new file is added. This process helps to manage the size of logs file. But in situations where production servers remain online for days and months without any restart, the logs file may be heavily populated. This causes difficulty while loading the file with more log records for analysis.
So a mechanism is required to process the log files without SQL Server restart. Following system stored procedure will do it for you

USE MASTER  
 EXEC sp_cycle_errorlog  
 GO  

As a result a new logs file will be craeted and oldest will be replaced if maximum count is going to be exceed.

Consult us to explore the Databases. Contact us