Cari Blog Ini

13 Juni 2012

Example of Shrink Database

--------------------------------------------------------------
-----code:start
--------------------------------------------------------------
USE [HRD]
GO

-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [HRD]
SET RECOVERY SIMPLE;
GO

-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (HRD_Data);
GO
DBCC SHRINKFILE (HRD_Log, 1);
GO

-- Reset the database recovery model.
ALTER DATABASE [HRD]
SET RECOVERY FULL;
GO

USE master
GO
--------------------------------------------------------------
-----code:end
--------------------------------------------------------------