Welcome To NetTech Solutions

Warm Welcome to Every Visitor. Here we serve best technical support, all the posts here you find will help you solving and facing the day to day problems.
Every one is welcome to comment on our Posts.

Tuesday, March 11, 2014

Safely Deleting SQL Server ErrorLog File

Today I came across an issue on one of my windows server disk space was getting full rapadely.
Then I analyzed my servers disk space by tool called Free Disk Analyzer. I found that my SQL Servers Log folder was crossing the limit and ERRORLOG was growing in GB's.

You can download this Tool from here as well. Free Disk Analyzer .

Then first question came in my mind, Can I delete this directly?
Then Second question was is it Safe to do that?

By default SQL Server stores seven ERRORLOG files named as below

ERRORLOG
ERRORLOG.1
ERRORLOG.2
ERRORLOG.3
ERRORLOG.4
ERRORLOG.5
ERRORLOG.6

In my SQL Server 2008 R2, ERRORLOG files are located in the "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log" folder. The ERRORLOG file contains the latest information and the ERRORLOG.6 file contains the older information.

My ERRORLOG files has grown too large in size, later I found a Stored Procedure to cycled the ERRORLOG file manually from the SQL server New Query window.

sp_cycle_errorlog

The data in the ERRORLOG files will be overwritten to ERRORLOG.1 file, you can make a copy of this old ERRORLOG.1 files to some external media if they are required for future reference.

It is now safe to delete the big size files.

Hope this helps...