Shrink the truncated log file on SQL Server

USE
 [DatabaseName];



GO




-- Truncate the log by changing the database recovery model to SIMPLE.




ALTER
DATABASE [DatabaseName]



SET
RECOVERY SIMPLE WITH NO_WAIT;



GO




-- Shrink the truncated log file to 1 MB.




DBCC
SHRINKFILE(DatabaseName_log, 1); --file_name is the logical name of the file to be shrink



GO




-- Reset the database recovery model.




ALTER
DATABASE [DatabaseName]



SET
RECOVERY FULL WITH NO_WAIT;



GO

Comments

Popular posts from this blog

SharePoint 2016 and 2019 Ports

Clear fields based on drop-down values in PowerApps

Hide a SharePoint list field based on user group using JQuery Webservice in 2010