SBS 2008 and SharePoint Log File

I am still encountering SBS 2008 servers where the Best Practices Analyzer (BPA) reports that the SharePoint SQL Log File is getting too large. There is a KB article that documents a script that will truncate the log file. I’ve created a zip file with the appropriate SQL command line plus a batch file to run it (see Part 1 below).

It is also recommend that after truncating the SharePoint database log file, that you set the recovery mode to “simple” for the database log file (see Part 2 below), and then you won’t need to use this command script again!

Part 1 – Running the command script

I created a zip file that contains both the SQL command line file that the KB article describes, plus a .cmd file that you can use to run the SQL command. In addition, my .cmd file will display the size of the SharePoint database log file both before and after.


  1. Click here to download my zip file. (be sure to rename it from logshrink.z_i_p to
  2. Create a directory C:\Scripts
  3. Extract the contents of the zip file to the C:\Scripts directory
  4. Review and edit the .cmd file to adjust the location of the SharePoint database log file. I usually move SharePoint to a D:\ (Data) drive.
  5. Create a shortcut to the logshrink.cmd file and place it on your desktop
  6. To run, right click on the shortcut and click ‘Run as administrator’
    Here is a screen shot of the results of running the script:

Part 2 – Switching Recovery Mode


  1. Open SQL Server Management Studio Express (using Run as Administrator)
  2. In the Connect to Server window, for the server name, enter: \\.\pipe\MSSQL&Microsoft##SSEE\sql\query
  3. Under Databases, locate SharePoint_Config_29c26fca…
  4. Right click on the above database, and click Properties
  5. Click on Options in the left frame, and in the right frame you will see that Recovery Mode is set to Full.
  6. Use the drop down option box and select Simple
  7. Click to save, and then exit SQL Server Management Studio Express
  8. Here’s a screen shot where you will change the recovery type from Full to Simple:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.