SQL Server Transaction Log – Large Size After Backup Issue

backupsql-server-2012transaction-log

I have a database that is on Full recovery mode.

I previously made a full backup, and then on a daily basis add differential backups.

Now I have backed up the transaction log for the first time, which reflected in the greatly increased file size of the .bak file. However the log file in the \DATA directory is still the same size.

I was under the impression that the transaction log file would automatically be truncated on a log backup, as mentioned here and elsewhere.

Previously I asked a question on Stack Overflow (here) where the answer indicated that the log file info was not up-to-date with the actual log on disk. Is that the case with this observation?

If so, how can I get the Windows file to refresh to display up-to-date data?

Best Answer

The transaction log does not automatically shrink because you did a backup. This is actually a good thing because processes actually stop when the log grows. Your log has grown to the current size because you had processes that required the log to grow to that size. These could have been long running units of work that generated a lot of log records (like index maintenance). The log 'truncation' you're referring to means that, after a log backup, log space is available for 'reuse'. Again, this process does not automatically reduce the size of the log. To reduce the log size,, you'd need to 'shrink' the log file. Repeated shrinking of the log is discouraged because it typically just re-grows, which affects performance. If you do 'shrink' the log, you should monitor the growth rate. Here is a helpful article. I also found this article that provides additional information.