Monday, December 10, 2012

Shrink LDF file in SQL SERVER 2008


First make the database to SIMPLE Recovery mode and do it.
 
– Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [databasename]
SET RECOVERY SIMPLE;
GO
– Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE ([log file name], 1);
GO
– Reset the database
ALTER DATABASE [databasename]
SET RECOVERY FULL;
GO
---
Thanks to Elam
http://www.elamparuthi.com/blog/2012/03/28/shrink-ldf-log-file-in-sql-server-2008/ 

No comments:

Post a Comment