How to shrink Huge SharePoint Content Database Log file?

August 1, 2009

After facing the problem of not being able to perform any action, like deleting, adding new list items, and after viewing WFE server application event viewer, i’ve figured out that my Back-end SQL server is out of space (the drive that holds the content databases and DB log files).

So after surfing microsoft’s website, i’ve found the best way to shrink the log file which was about 60 GB to be any size that i want (say 10 MB).

  1. open up SQL management studio.
  2. open a new query window.
  3. paste the following command lines:

USE WSS_Content_Web;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE WSS_Content_Web
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 10 MB.
DBCC SHRINKFILE (WSS_Content_Web_log, 10);
GO
-- Reset the database recovery model.
ALTER DATABASE WSS_Content_Web
SET RECOVERY FULL;
GO

 Execute (F5).