How to shrink an MSSQL database log file.

Posted: November 2, 2010 in Uncategorized

You can use the following MSSQL query to shrink the database log file:

USE “database”;

— Changing the database recovery model to SIMPLE.
ALTER DATABASE “database” SET RECOVERY SIMPLE;

— Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (database_Log, 1);

— Reset the database recovery model.
ALTER DATABASE “database” SET RECOVERY FULL;

To find the log file name go to MSSQL Management Studio >> Right click on the corresponding database >> properties >> files >> Logical name

Hope this will help to shrink the database log file to 1MB.

Comments
  1. about us says:

    i want to get one

Leave a comment