Search This Blog

Google Analytics

Tuesday, May 17, 2011

Database Shrink MsSQL database log file

Many questions have been raised on the Internet on how to shrink the file size of a database log file. The following code snippet will do what is needed (replace mydbname with your database name).

USE mydbname
GO

ALTER DATABASE mydbname Set Recovery Simple
GO
ALTER DATABASE mydbname Set Recovery Full
GO
DBCC SHRINKFILE ('mydbname_log', 1)
GO

No comments:

Post a Comment

Do provide your constructive comment. I appreciate that.

Popular Posts