SBS 2008 and Sharepoint Log file

If using SBS 2008, one of the things you want to do is to install and run the SBS 2008 Best Practices Analyzer (BPA) on a regular basis. At my first SBS 2008 installation, BPA recenlty reported that my Sharepoint log file was larger than 1gb in size. Strange, I thought, since this customer had not even started using sharepoint. Beyond that, BPA did not offer any suggestions for resolving this issue.


So, here are the instructions (from the SBS BPA team) on what to do:


Step 1: start up command prompt in administrator mode. You do this by clicking on Start, then right clicking on Command Prompt, then clicking ‘run as Administrator’


Step 2: From the command prompt:
1. Type: sqlcmd –E –S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query and press Enter
2. From the 1> prompt, type: select name from sys.databases and press Enter
3. From the 2> prompt, type: go and press Enter
This will display a list of all databases know to SQL server. One of them will look something like this:
SharePoint_Config_29c26fca….


Step 3: Now, with the actual name of the Sharepoint database, you will want to enter the following commands, replacing dbname with the actual name of the Sharepoint database. Be sure to leave the brackets [ ], parens ( ), and _log, as noted:

1> BACKUP LOG [dbname] WITH TRUNCATE_ONLY
2> Go
1> Use [dbname]
2> Go
1> DBCC SHRINKFILE([dbname_log],2)
2> Go
1> Exit

For example, if your Sharepoint database was named SharePoint_Config_12345, then you would type in:


1> BACKUP LOG [SharePoint_Config_12345] WITH TRUNCATE_ONLY
2> Go
1> Use [SharePoint_Config_12345]
2> Go
1> DBCC SHRINKFILE([SharePoint_Config_12345_log],2)
2> Go
1> Exit


Hope this helps!

3 thoughts on “SBS 2008 and Sharepoint Log file”

  1. If you are using the Windows internal database, if the sqlcmd command errors, try adding np: prior to the double backslashes. Like this:
    sqlcmd –E –S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query

    Hope this helps!

  2. You can also use SQL Server Management Studio to connect to an instance of Windows Internal Database using \\.\pipe\mssql$microsoft##ssee\sql\query as server name.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>