Link to home
Start Free TrialLog in
Avatar of AntExpert
AntExpertFlag for United States of America

asked on

Dynamics 2011 SL & SQl 2008 R2 transaction logs

I am using Dynamics SL 2011 & SQL 2008 R2.  All the transaction logs keep growing even after backups. Every so often, I have to change the recovery model to simple in order to reduce the transactions log file size, then set it back to Full. Any ideas?
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

>> All the transaction logs keep growing even after backups

What is the frequency of Transaction Log backups, for a huge growing database it is recommended to take log backups once every 15 minutes or 10 minutes.

>> Every so often, I have to change the recovery model to simple in order to reduce the transactions log file size, then set it back to Full.

Changing recovery model to Simple will break your Log backup chain and requires you to take Full backup after you change it back to Full Recovery and hence not recommended for critical production databases.
All the transaction logs keep growing even after backups.
Well, that's the expected behaviour if you're not running transaction log backups.
Avatar of AntExpert

ASKER

Transaction log backups are taken every hour.
How big is in average each of the transaction log backups?
If the are too big, just follow Raja's suggestion to backup them more often.
Backups are not reducing the log size, that is the issue. By the end of the week the transaction logs are bigger than the database for some reason. I was hoping someone encountered this before.
>> Backups are not reducing the log size, that is the issue. By the end of the week the transaction logs are bigger than the database for some reason

If backups are not getting reduced, then check the reason for Log_reuse_wait_desc from sys.databases table and also check the following:
1. Whether there are any long running transactions
2. Any uncommitted transactions running for longer time
3. Do you have any huge tables with lot of indexes getting fragmented regularly
4. Whether your database is in Full Recovery mode
5. Whether you have any Replication or Mirroring or Log Shipping configured or not

Kindly provide the above details to suggest you better.
Backups are not reducing the log size
Do you mean the transaction log file? If so then backups doesn't really reduce the transaction log file. For that you'll need to run a DBCC SHRINKFILE command.
So taking an hourly transaction log backup, plus a full backup at the end of everyday, will not reduce the log size, they need to be manually shrunk?
And yes all databases are in full recovery mode.
So taking an hourly transaction log backup, plus a full backup at the end of everyday, will not reduce the log size, they need to be manually shrunk?
It depends how much transactions the database has in an hour. And as said before, backup doesn't shrink files. It only empty the file (mark all freed space with zeros) but backing it up more often it will avoid the file to grow.
Raja,
1. Whether there are any long running transactions -> (I am not sure how to verify this)
2. Any uncommitted transactions running for longer time -> (I am not sure how to verify this)
3. Do you have any huge tables with lot of indexes getting fragmented regularly -> (the entire database is under 20GB)
4. Whether your database is in Full Recovery mode -> ( it is in Full Recovery Mode)
5. Whether you have any Replication or Mirroring or Log Shipping configured or not-> ( no replication or mirror)
ASKER CERTIFIED SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The transaction logs grow almost as large as the databases (20GB) but it takes a week or 2 to get there.
I will check long running queries or transactions, thanks!
Every Sunday there is a maintenance schedule to reindex and clean up all databases.
if it is taking 2 weeks to grow, then check for any jobs scheduled to run once every week or 2 weeks like your Index Reorganization job.
Since your Recovery model is set to FULL, there are chances that your Index Rebuild job(running only on Sundays) can increase your Log file size, if so then you need to manually shrink your Log file after Index Rebuild job completes..
Great information everyone, thank you
Unfortunately, the problem seems to have resolved itself, the transaction log files are very small all of a sudden. I believe the issue was due to long running queries or transactions like Raja indicated. If the issue comes up again, I have this as a reference.
Thanks!
Thanks for the update..