Thursday, October 29, 2009

How To: Reduce SharePoint database log file size?

Sometimes, your SharePoint server space may be very low. This is because, the SharePoint server database log will be increased slowly day by day. 

For example, you may have 30 or 40 GB free space in C drive, when you installed SQL Server in your database server. After 1 or 2 months, your database server C drive may be very low. So that you will get "Low disk space" error. This is beacuse, the log file size will be high.

So, here I am going to explain, how to reduce the size of the Database log file size to 1MB. 

1. First open your SQL Server management studio 2005.
2. Click "New Query"
3. Type the below Command. Here, "WSS_Content_10002" is my database name. replace this text with your database name.

BACKUP LOG [WSS_Content_10002] WITH TRUNCATE_ONLY
USE [WSS_Content_10002]
GO
DBCC SHRINKFILE ('WSS_Content_10002_log' , 1)  
GO

Finished. Now, you can see that the free space in C Drive will be increased.

Thats it....

2 comments:

  1. Many thanks, worked like a charm!

    ReplyDelete
  2. Many-many thanks man, a simple query solution solved a Giga-problem!

    ReplyDelete