Friday, March 07, 2008

Big Sharepoint Database, SHRINK .LDF file

Do you have space problem and you see your databases and see .mdf file with 100 mb and you .ldf file WITH 9GB you think "what in the hell...", can SHRINK the file, to do that just use this querys....

Using Management SQL Server
  1. Right click WSS_Content Database and select Tasks then Backup
  2. Select backtup type "Transaction log", and select destination backup file and click Ok.
  3. After backing up the DB, right click WSS_Content database and choose Tasks then Shrink and Files
  4. Select the type log and shrink action verify your space disk....
Support Document
SharePoint 2007:
Database maintenance for Office SharePoint Server 2007
SharePoint 2010:
Database maintenance for SharePoint Server 2010

USE BY YOUR OWN RISK....

List Databases
SELECT name FROM master..sysdatabases ORDER BY name

--Chose Databases
USE DATABASENAME
GO
DBCC SHRINKFILE(, 1)
BACKUP LOG DATABASENAME WITH TRUNCATE_ONLY
DBCC SHRINKFILE(, 1)
GO
Post a Comment