Monday, October 10, 2011

Shrinking a log file to a specified target size in sql

USE STAG_2011Q1_EUROPE;


GO

-- Truncate the log by changing the database recovery model to SIMPLE.

ALTER DATABASE STAG_2011Q1_EUROPE

SET RECOVERY SIMPLE;

GO

-- Shrink the truncated log file to 1 MB.

DBCC SHRINKFILE (STAG_2011Q1_EUROPE_log, 10000);

GO

-- Reset the database recovery model.

ALTER DATABASE STAG_2011Q1_EUROPE

SET RECOVERY FULL;

GO





No comments:

Post a Comment