SQL SERVER

Reduce Database log size SQL Server

Written by shohal

This is one of the best suggestion in which is done using query. Good for those who has a lot of databases just like me. Can run it using a 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 (Document_Movement_upload_20171003_log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE DatabaseName
SET RECOVERY FULL;
GO

For More Please Visit: https://stackoverflow.com/questions/829542/how-do-i-decrease-the-size-of-my-sql-server-log-file

About the author

shohal

Leave a Comment