Syntax of Shrinking SQL Server Log and mdf file

The below code snippet will help you to shrink the SQL Server Log File & Database. Run the code snippet through your SQL Server query analyzer.

Code to Shrink SQL Server Database Log File and Data File:

backup log <database_name> with truncate_only 
use <database_name> 
dbcc SHRINKFILE (<database_name_Log>,2) 
dbcc ShrinkDatabase (<database_name>, 2)

Hope it will help you.

Posted in Database, SQL Server

Leave a Reply

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