Tuesday, June 21, 2011

Reduce Log File Size

/*Run below script to reduce the database Log file size*/

USE [Database_Name] 
GO 
DECLARE @LogFileName nvarchar(255) 
ALTER DATABASE Database_Name 
SET RECOVERY SIMPLE 
SELECT @LogFileName = name FROM SYS.database_files where type_desc = 'LOG' 
DBCC SHRINKFILE (@LogFileName, 1) 
ALTER DATABASE Database_Name 
SET RECOVERY FULL

No comments:

Post a Comment