SQL Server 2005 – How to shrink the truncated log file.

To shrink the Trucated Log file.

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

USE Master
--You can replace with the database name but if it doesnt 
--works then replace with master databas)
GO DBCC SHRINKFILE(<TransactionLogName>, 1) 
BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY 
DBCC SHRINKFILE(<TransactionLogName>, 1)
Advertisements

2 thoughts on “SQL Server 2005 – How to shrink the truncated log file.

  1. Thanks for your comments , a + b will always add the things.

    Same way we have some expression BACKUP LOG WITH TRUNCATE_ONLY
    which are builtin, so we are using them , I did the same.

    Rana

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s