Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Best Practice for Managing Transaction Log File

Author  Topic 

ejbatu
Starting Member

21 Posts

Posted - 2010-09-30 : 12:36:02
Hi,

What is the best way managing tlog from growing so large during/after a weekly maintenance?
1. - Is it to set the recovery mode to simple
- do reorganize index
- rebuild index
- update stat
- set recovery mode to full
- shrink tlog file
- do a full backup

2. Do a more frequent backup on the tlog file (maybe every 20mins)
- do reorganize index
- rebuild index
- update stat

If you have a better way of doing managing, please share

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-30 : 13:33:58
1. Switch to SIMPLE recovery model. That's it. Perform a full backup daily/weekly, whatever you require. Never shrink the database files except on a one-off. Update stats/index rebuilds/reorganizes are not related to managing the tlog.
2. Use FULL recovery model, backup the tlog every 15 minutes, full backup daily/weekly, whatever you require. Add in diffs too if you'd like. Again update stats and index stuff is not related to managing the tlog size.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-30 : 13:34:39
You could also consider BULK_LOGGED recovery model in place of my #2, however I prefer FULL on my systems due to the criticality of the data and the need for more recovery points.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ejbatu
Starting Member

21 Posts

Posted - 2010-09-30 : 13:43:13
Tara thanks for the reply.

What do you mean by:
quote:
Update stats/index rebuilds/reorganizes are not related to managing the tlog.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-30 : 13:46:27
Well they aren't related to managing the transaction log.

Only thing that matters is recovery model plus backups.

Now rebuilding indexes, etc... can INCREASE the size of the transaction log, but they will not help manage it.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ejbatu
Starting Member

21 Posts

Posted - 2010-10-01 : 10:45:00
What is an acceptable size of a t-log file?
Also if you don't mind sharing, what your current production DB data size and t-log size?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-01 : 12:31:02
The size of the transaction log is dependent on the transactions that are being done. It isn't something that I can give a direct answer to as it depends on your environment.

A guess would be 25%-125% of the size of the data file.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -