Darth Rob - SQL Topics

Thursday, June 29, 2006

Truncating SQL LDF Files

In SQL Server, quite often I find that LDF Files grow leaps and bounds even though the recovery mode is set to Simple. Annoying as it is, it's a fact of life that large transactions have to be stored somewhere. However, once the transaction has completed, LDF files don't automatically shrink. So, from time to time, we'll run the following command to shrink the log:

BACKUP LOG database_name WITH TRUNCATE_ONLY

Keep in mind that this should only be done in extreme cases when you either have no choice but to truncate the log or when you have no use for point-in-time recovery as this command basically blows away the transaction log without backing it up.

0 Comments:

Post a Comment

<< Home