Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are running out of space. What is the safe way to clear the error log?

What is the safe way to clear this?

share|improve this question
up vote 13 down vote accepted

You can cycle the error log by calling sp_cycle_errorlog and then that will close the current error log and cycle the log extensions. Basically, it'll create a new error log file that SQL Server will be hitting. Then the archived error log(s) can be treated accordingly (delete/move with caution). This will not technically "truncate" the log, it'll just roll it over and you can handle the old logs as you so please, like any other file system file.

When you do this, you should see a new log file with an entry that resembles the following:

The error log has been reinitialized. See the previous log for older entries.

BOL reference on sp_cycle_errorlog

share|improve this answer
@JohnDaCosta what? No. Read the question again and take a closer look at the picture. – ivanmp Jan 5 '13 at 9:00
@JohnDaCosta please reread the question. I believe you are mistaken. – Thomas Stringer Jan 5 '13 at 12:56
It's worth noting that sp_cycle_errorlog only recycles ONE log file. But because there are 7 files, if you really want to purge them and save space (as I did) you will need to run the command several times (7 times to be exact). And each time you run it one of these files will be shrunk: ErrorLog ErrorLog.1 ErrorLog.2 ErrorLog.3 ErrorLog.4 ErrorLog.5 ErrorLog.6 – Digs Mar 18 '14 at 13:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.