How to Shrinking Log File to a Specified Size in Microsoft SQL Server

USE Database_Name; (Replace the Database_Name with your actual database name)

GO

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

ALTER DATABASE Database_Name

SET RECOVERY SIMPLE;

GO

— Shrink the truncated log file to 1 MB.

DBCC SHRINKFILE (Database_Name_log, 10000);

GO

— Reset the database recovery model.

ALTER DATABASE Database_Name

SET RECOVERY FULL;

GO

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.