3

We are using SQL Server 2012 standard Edition (SP4)- 11.0.700.0(x64) (Build 14393)(HYpervisor).

Data File Size = 171 GB Log File Size = 106 GB

When I queried sys.databases to see the log_reuse_Wait_desc it is always LOG_BACKUP- even right after log backup!
When I run DBCC SQLPERF(logspace) I see "Log space Used %" is less than 1%. DBCC loginfo returns 773 which is high.

FYI- This database is not involved in Log Shipping/replication/mirroring. The recovery model for this DB is Full and log backups are taken every 30 minutes. I know log backups are happening as I checked from msdb.dbo.backupset.

This database had % autogrowth setting on log file until last week. I changed it as part of config change.

How do I find why the log_reuse_desc is returning LOG_BACKUP always?

I would like to explore some options to reduce the log file size on the disk. (I know it is a bad bad thing to trucate and shrink the log file, but at this point I would like to know my options available). Can someone please suggest a graceful way to do this.

2

When I queried sys.databases to see the log_reuse_Wait_desc it is always LOG_BACKUP- even right after log backup! how do I find why the log_reuse_desc is returning LOG_BACKUP always.

This is nicely explained by Paul Randal:

Imagine a database where there’s very little insert/update/delete/DDL activity, so in between your regular log backups there are only a few log records generated, and they’re all in the same VLF. The next log backup runs, backing up those few log records, but it can’t clear the current VLF, so can’t clear log_reuse_wait_desc. As soon as there are enough changes in the database that the current VLF fills up and the next VLF is activated, the next log backup should be able to clear the previous VLF and then the log_reuse_wait_desc will revert to NOTHING. Until the next log backup occurs and isn’t able to clear the current VLF, in which case it will go back to LOG_BACKUP again.

So LOG_BACKUP really means “either you need to take a log backup, or the log records that were backed up were all in the current VLF and so it could not be cleared.”

Full article: Why is log_reuse_wait_desc saying LOG_BACKUP after doing a log backup?

I would like to explore some options to reduce the log file size on the disk.

Before you shrink the log files it is also important for you to understand how you end up with too many or too less number of VLF's. I suggest you read the following posts. These will give you a better idea about VLF and transaction log management.

  1. A Busy/Accidental DBA’s Guide to Managing VLFs by David Levy
  2. How do you clear the SQL Server transaction log? by Aaron Bertrand
  3. Aaron added 4 more links at the bottom of his answer, all those are very useful and related to your question.
  4. Transaction Log VLFs – too many or too few? by Kimberly Tripp
  • appreciate pointing to the relevant links.Followed Aaron Bertrand's post and was able to reduce the log file size to a proper size. So far so good... – SQLQuest Sep 24 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.