Monday, May 28, 2012

Prune disk space on the drive of MSSQL Server

When the disk space is full on the Windows Server, there are many ways to free some disk space on the server.

One of the way is that if you have Microsoft SQL Server 2005 installed on the server, then you can delete the Error logs which consumes disk space on the server.

Please refer to the steps to delete the MSSQL Error Log file:

1. Login to the Microsoft SQL Server Management studio.
2. Login with the Windows Authentication.
3. Click on Databases.
4. Click on New Query.
5. Make sure that you have "master" database selected in the drop down box of "Available Databases".
6. You have to execute the following query on the master database:

EXEC sp_cycle_errorlog ;
GO


7. Once you execute the query, the current error log is renamed to ERRORLOG.1 which you can see in the specific path for the log file.
For Example: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG


8. You can delete ERRORLOG.1 to free some disk space on the server.
9. sp_cycle_errorlog enables you to cycle the error log files without stopping and starting the SQL service.

There is no need to restart the SQL service.

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