Shrink MSSQL Databases

There are several ways to shrink or truncate your MS SQL databases. One procedure is to run a backup from within the Enterprise Manager.

  • Open Enterprise Manager
  • Expand your SQL Server Group and your Local server
  • Expand Databases
  • Right Click the database you would like to backup
  • Under All Tasks Select Backup Database
  • Select Database-complete
  • Add a Destination
  • Under the Options Tab Select Remove inactive entries from transaction log
  • Click OK.

At times, I have been able to successfully backup a database using the instructions above but the procedure did not truncate or shrink the logs.  You can run the following query to manually truncate/shrink the logs.

  • Open SQL Query Analyzer
  • Run the following Query:

declare @dbname nvarchar(255)

set @dbname = ‘yourdatabasenamehere’

backup log @dbname with truncate_only

DBCC SHRINKDATABASE (@dbname, 0)

Leave a Reply

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


*

Subscribe without commenting