Pages

Wednesday, August 31, 2011

Shrink SQL Server Database



Method 1

ALTER DATABASE DatabaseName SET RECOVERY SIMPLE
use DatabaseName
GO
CHECKPOINT
GO
DBCC SHRINKFILE(transactionloglogicalfilename,TRUNCATEONLY)
GO
ALTER DATABASE DatabaseName SET RECOVERY FULL

Method 2

USE DatabaseName
GO
ABCC SHRINKFILE(, 1)
BACKUP LOG WITH TRUNCATE_ONLY
ABCC SHRINKFILE(, 1)
GO

No comments:

Post a Comment