Search This Blog

Saturday, August 28, 2021

MSSQL: Decrease/Reduce the size of sql server log file

 

USE Your_Database_Name;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE Your_Database_Name
SET RECOVERY SIMPLE; GO DBCC SHRINKFILE (Your_Database_Name_Log, 1); -- Will resize log file to 1 MB.
GO ALTER DATABASE Your_Database_Name -- Reset the database recovery model.
SET RECOVERY FULL; GO

No comments:

Post a Comment