IT Core Blog

Never stop questioning. Curiosity has its own reason for existing…

How to Shrink, Truncate SQL Log File

leave a comment »

Today I decided to post a solution to an issue that I run from time to time. Sometimes it appears to be impossible shrinking the SQL Log file. The following code has always worked for me and 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

Done!!! 🙂

Advertisements

Written by IT Core

January 2, 2010 at 12:00 AM

Posted in How to...

Tagged with

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

%d bloggers like this: