SQL Server - DBCC ERRORLOG or exec master..sp_cycle_errorlog

25 November,2012 by Tom Collins

DBCC ERRORLOG and master..sp_cycle_errorlog    recycle the SQL Server Error Log Files without a SQL Server restart required. Both the commands have the same impact, so either one will complete the goal of cycling through the error logs..

 When calling master..sp_cycle_errorlog     , the code within the stored procedure requests an execute of DBCC ERRORLOG . There are some extra built in checks , such as checking if the requestor is a sysadmin role member  and if not raising an error.


if (not (is_srvrolemember('sysadmin') = 1


Depending on configurations SQL Server Error log files can grow. Consider scheduling a regular job to recycle the logs

By default, only the previous six log files are kept . The text version of the log files are found in \Program Files\Microsoft SQL Server\MSSQL\LOG\*.  Also use , SQL Server xp_regread with T-SQL for SQL Error Log Path and ...  to find the path

An added option , if you’re truncating log files is to first backup the log files.

Read More

SQL Server - Powershell and SQL Error Logs - SQL Server DBA

SQL Server Error Log Check - SQL Server DBA

Author: Tom Collins (http://www.sqlserver-dba.com)


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on SQL Server - DBCC ERRORLOG or exec master..sp_cycle_errorlog

sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer