26

May

2008

MS SQL SERVER – Shrinking Truncate Log File (Log Full)

Is it impossible to shrink the Trucated Log file?

Yes, following code always shrinks the Trucated Log File to minimum size possible.

1) Replace DatabaseName with your database name
2) Replace TransactionLogName to database log name

USE DatabaseName
GO

DBCC SHRINKFILE(TransactionLogName, 1)
BACKUP LOG DatabaseName WITH TRUNCATE_ONLY
DBCC SHRINKFILE(TransactionLogName, 1)
GO 

Is is simple?

Comments are closed.