Shrinking SQL Server Db_log file size — SQL Server DB Maintenance
1 min readAug 27, 2019
Below is a script which reduces the size of DB_log.ldf file in SQL Server
Some times SQL DB_log.ldf takes up more server space in GBs to shrink and reduce the size of the log file to less than 15 MB from GB execute the below mentioned script.
USE DatabaseName;
GO
-- 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 (DatabaseName_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE DatabaseName
SET RECOVERY FULL;
GO
For more such interesting technology related blogs, resources visit my site https://sharetechlinks.com/