J Wolfgang Goerlich's thoughts on Information Security
SQL Server Tip: Shrink Database

By wolfgang. 10 September 2008 20:54

This tip works on SQL Server 2000 and SQL Server 2005. To shrink the db, use the logical name. You have to put it into simple recovery mode to get the disk space back. The command I have been running is:

Alter Database MYDBName Set Recovery SIMPLE

DBCC Shrinkfile (MYDBName_Log)

Alter Database MYDBName Set Recovery FULL

 

I should note that this is for emergency purposes only. It will impact performance by increasing fragmentation within the file and causing a write penalty later when the logs grow.

 

Tags:

Systems Engineering

    Log in