Are there any best practices for configuring a Maintenance Plan in SQL Server 2008? Currently, I'm removing database backups and transaction logs greater than 40 hours old, then backing them up. Problem I've seen is that the transaction log is still very large. Should I be including a Shrink Database Plan task?
|
migrated from stackoverflow.com Feb 8 '12 at 16:33
|
If your log file is growing that large then you are doing at least one of these things wrong:
In order to shrink the log for now, if you are in full recovery model and want to stay that way, you should perform these steps and restart your log chain to be safe:
I commented lines that should be removed if you're already in simple (highly unlikely) or if you want to switch to simple. |
|||
|
|
|
You definitely don't want any scheduled file shrinking, or else you'll end up with horrible disk fragmentation. Do it manually on a case-by-case basis, and only when you're sure that the excessive growth was a fluke, for example due to log backups failing to run, or some massive ETL that isn't expected to happen regularly. Make backups often enough (and keep them long enough) to meet the retention requirements of your business/application. Also consider that you should make log backups often enough to keep the transaction log within an acceptable size. In my case, I run log backups hourly on weekdays, but there's plenty of room to adjust the schedule to your needs. Run them more often to reduce log bloat, and less often to make restoring the log sequence less of a pain. |
|||
|
|
|
Your transaction log is still very large probably due to the amount of activity. If you would like to be able to restore to point in time(full recovery mode) and control the transaction log, more frequent transaction log backups is the answer. We have a 300 gb OLTP database with 30 gb allocated log space. I have a job in place to take log backups every 30 min and that keeps the log file well under the allocated space (even during the monthly index rebuilds. The log backup sizes during rebuilds will be large, though). Shrinking is not a good practice at all. |
|||
|
|