How to Truncate and Shrink the WSS_Content_log File

UPDATE: The following post applies to SQL Server 2005.

You might run into a scenario on your SharePoint development box where the WSS_Content_log file grows to be quite large. If you’re limited on hard drive space and need to know how to truncate and shrink this log file, follow the directions below. For my particular installation, I had WSS 3.0 and SSEE installed with all the defaults.

Before we begin, you may want to take a bit of time to learn about Recovery Models, Truncating and Shrinking.

  1. Let’s start. Open Microsoft SQL Server Management Studio Express. If you don’t have that tool installed, you can get it free from Microsoft. Expand Databases. Right click on the WSS_Content database, go to Properties, Options, and change Recovery model: to Simple. Click OK.
  2. Click New Query. Once the blank page opens up, make sure the WSS_Content database is selected.
  3. Run the following command first. This will truncate the log file. We must do this step first before we can shrink the file.

  4. The next step will actually shrink the log file and recover our disk space. You can use the command below to confirm the name of the file we’ll be shrinking.

    SELECT * FROM sys.sysfiles
  5. The name column will give us the information for the last command – the name of the log file itself. In this case, it’s WSS_Content_log:

    DBCC SHRINKFILE(WSS_Content_log, 1)

That should do it. I had a 4 gig content db and a 26 gig log file. All of the above took about 5 minutes or so.

7 Responses to “How to Truncate and Shrink the WSS_Content_log File”

  1. Vladimir February 1, 2012 at 7:19 pm #

    hi. if i run command “backup lo wss_content with truncate_only” a see message “truncate_only is not recognized backup option”. what’s do i wrong ?

  2. shereen February 2, 2012 at 11:47 am #

    Hi Vladimir,

    What version of SQL Server are you using?

  3. Jonathan April 13, 2012 at 8:09 am #

    This did not work for me either. Using SQL 2008

    Also, cannot perform a log backup without a full backup and having the recovery mode set to full

  4. shereen April 13, 2012 at 8:58 am #

    Thanks Jonathan,

    I’ve updated the blog post to reflect that the solution is targeted for SQL Server 2005.

  5. nate June 5, 2014 at 6:29 pm #

    This worked great for my 2013 sharepoint setup! I am running sql 2007

  6. Nina November 4, 2014 at 8:28 am #

    Worked great for me – but only when i changed the size from 1 to 50. Otherwise nothing happened. But thanks for the help!


  1. Links (1/22/2009) « Steve Pietrek - Everything SharePoint - January 22, 2009

    […] How to Truncate and Shrink the WSS_Content_log File […]

Leave a Reply