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.
- 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.
- Click New Query. Once the blank page opens up, make sure the WSS_Content database is selected.
Run the following command first. This will truncate the log file. We must do this step first before we can shrink the file.
BACKUP LOG WSS_Content WITH TRUNCATE_ONLY
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
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.