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.

    1
    
    BACKUP LOG WSS_Content WITH TRUNCATE_ONLY
  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.

    1
    
    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:

    1
    
    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.

« »