Shrink log file script for MSSQL Server




When trying to shrink huge log files, because of the missing backup of transaction log and corresponding option to truncate log. So first backup your databases and replace your_database with one you want to.


 USE  Your_Database
 GO
 DBCC SHRINKFILE(Your_Database_log, 10)
 GO
 BACKUP LOG  Your_Database WITH TRUNCATE_ONLY
  GO
 DBCC SHRINKFILE(Your_Database_log, 10)
 GO

Apply to MSSQL Server 2005

No response to “Shrink log file script for MSSQL Server”

Post a Comment