Sunday 31 March 2013

Shrinking Truncate SQL SERVER Log File

Following code always shrinks the Truncated Log File to minimum size possible.

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

You are recommended to take full back up right before/after above query.

1 comment: