Tuesday 24 April 2018

Shrink 2008 MSSQL database

Shrink 2008 MSSQL database

Shrinking SQL 2008 database is nowhere related to SQL 2000/2005 Method. Because SQL Server 2008 no longer allows you to truncate the transaction log using the no_log syntax
But here is the special code to shrink the database:

USE MASTER
GO
ALTER DATABASE database_name SET RECOVERY SIMPLE
GO
USE database_name
GO
DBCC SHRINKFILE (database_name_log, 1)
GO
ALTER DATABASE database_name SET RECOVERY FULL
GO     Read more

No comments:

Post a Comment