Truncate SQL Server Error Logs

If we have a SQL server in place, it is a usual task to clean up the disk because of disk space constraints. I was searching how can I get enough space needed without clearing those error logs. And if you find yourself held in such a scenario, then this post is intended for you.

sp_cycle_errorlog is the solution for this.

EXEC sp_cycle_errorlog ;
GO

What this actually does?

Executing this in the database will cycle the error log files without stopping and starting the SQL server. This will close the current error log and cycle the log extensions. Note that this will not technically truncate the log, but roll it over so that you can do a delete or move of these archived logs as you wish.

LET US KNOW YOUR RATINGS ON THIS BLOG HERE. ALSO FEEL FREE TO CONTACT ME HERE.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s