Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Truncating the Transaction Log
Message
General information
Forum:
Microsoft SQL Server
Category:
Database management
Miscellaneous
Thread ID:
00518393
Message ID:
00518530
Views:
8
See if the file shrinks some time after you truncate (i.e., truncate, wait a while, and then check).

The reason why is that not all the data in the log is removed. Some of the log is still needed to maintain the integrity of the db. When you truncate the log, SQL Server marks any pages it doesn't need as junk, and then tries to shrink the log until it hits a page it needs. The problem is that if the "junk" is in the middle, then it doesn't get deleted.

I.E.
Log:
[need] [junk] [junk] [junk] [need] : This file doesn't get shrunk

Once a [need] is cleared (which will probably happen as the database is used), then SQL Server can clear out the junk pages inbetween. Also, IIRC, BOL has some stuff regarding this behavior if you need to find out more.

HTH,
John Barone


>Hello,
>
>I have log file more that 4GB while data file is 4.5GB.
>I've tried to truncate log file, but size of the file doesn't chenged.
>Where is the problem?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform