We have a problem with just one of the databases on our SQL2008 Server. For some reason recently the log file is just growing and growing.
The server runs the following backups
- Weekly – Full
- Daily – Diff
- Hourly – Transactional
I have followed the information here (Why Does the Transaction Log Keep Growing or Run Out of Space?) but without any luck and have confirmed the following:
- The database is in FULL recovery mode
- Backups are occuring as expected (Hourly, Daily, Weekly)
- The log file is full, it's that that there is space that can be recovered
- Looking at the log_reuse_wait_desc returns 'NOTHING'
The website associated with the database is the most used site we have, but the database and usage is still small (under 5Gb of data) a few hundred users a day, but the Log file gets over 10Gb after a couple of days.
Anyone any idea what could be causing this? The only way I can find to get around this is to switch to 'SIMPLE' recovery mode. Shrink the file, switch back to 'FULL' then do a new Full backup to start a new chain.
Thanks for any advice you can provide
Best Answer
Conceptually this is what should be happening within your database when the end of the physical file is reached:
However, it sounds like you have a log header that doesn't want to wrap back around to the start of the physical log file and continues to fire off auto-growth events instead. This can occur for any number of reasons, but the most common is a vlf in front of the logical log has a DBCC LOGINFO status of 2 for whatever reason, even after switching recovery models as you're doing now, but the way to fix it is the same regardless of the reason. Simply perform the following steps:
BACKUP LOG [DBNAME]...
) against the databaseSo what's happening here?
One final note on the process. If your tlog is highly active, you may need to perform this a few times or during a window of reduced activity. High activity may result in another errant auto-growth event occurring before you execute the second log backup. This basically turns what you thought was step 3 back into step 1. Generally Steps 1 and 2 go by quickly, and step 3 takes the longest to complete. Make sure to follow-through with steps 4 and 5.