How to best delete SQL Server 2005 errorlog

  • There was an outage on a SQL server 2005 server which created many errors. This caused the errorlog to grow too much. We have cycled the log file (sp_cycle_errorlog), so we have a new file. The problem is that we want to recover the disk space used by the previous file (errorlog.1). Apart from just deleting the file, what is the best way to delete this file to avoid causing any problems? We have already inspected the contents of the file.

    thanks.

  • You won't hurt anything by deleting the old error log file and that's the only way to get rid of it.

    Greg

  • You should just be able to issue sp_cycle_errorlog until you reach you max set of saved logs, after that you can delete.

    Andrew

  • Actually, if you repeatedly execute sp_cycle_errorlog as Andrew suggests, you wouldn't have to delete the file at all. It would automatically drop off when you went past the configured max number of error logs.

    Greg

  • great help! Thanks guys!

  • [font="Verdana"]There are couple of ways to do it.

    1. Textbook Way- sp_cycle_errorlog - Closes the current error log file and cycles the error log extension numbers just like a server restart. The new error log contains version and copyright information and a line indicating that the new log has been created.

    Ref.

    http://msdn.microsoft.com/en-us/library/ms182512.aspx

    2. Restart the SQL Services

    3. Stop the Service - Rename The File - Restart the Service.

    Enjoy SQL'ing[/font]

    ~RD

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply