Cycle SQL Server Error Log files using DBCC ERRORLOG

By default, there are 7 error logs in SQL Server, current and Errorlog.1 to Errorlog.6:

Error logs in SQL Server

The Error log is re-created every time SQL Server is restarted. The current error log is then renamed to Errorlog.1, previous Errorlog.1 is renamed to Errorlog.2, and so on. Log that was called Errorlog.6 is deleted.

If you rarely restart the SQL Server service, error logs can get very large. You can create a new log by running this command:

DBCC ERRORLOG

dbcc errorlog command

After you run the command, a new error log is created, and the oldest one is deleted:

SQL Server error log

You can accomplish the same thing, to cycle the error log, by using the stored procedure sp_cycle_errorlog:

EXEC sp_cycle_errorlog;
GO

To see how to increase the number of SQL Server Error Log files, read related blog post:
How to increase the number of SQL Server Error Log files

If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">