Truncate SQL Log file to 1 MB

SQL

Sometimes, you database log file is grown very big since you use full recovery mode. To reduce log file size to 1 MB pls run the follwing T-SQL snipset

USE EPower;  
GO  
-- Truncate the log by changing the database recovery model to SIMPLE.  
ALTER DATABASE EPower  
SET RECOVERY SIMPLE;  
GO  
-- Shrink the truncated log file to 1 MB.  
DBCC SHRINKFILE (EPower_log, 1);  
GO  
-- Reset the database recovery model.  
ALTER DATABASE EPower
SET RECOVERY FULL;  
GO

 

Leave a Reply

Your email address will not be published. Required fields are marked *