Shrinking SQL Database Log File using Query

USE <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 log file name>‚Äč, 1);
GO

Advertisements