Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Huge Transaction Log - Is This Normal?

Tags:

sql-server

I have a 5GB database and a 20GB transaction log (SQL Server 2005). Not sure why it is so large or what happened to make it that large, it used to be around 1/2 the size of the DB. DB grows about 1GB/month.

Are there any guidelines to how how big your transaction log should be relative to your database file size?

EDIT: I'm not saying my transaction log is huge (I know some DBAs would laugh at my weenie-sized DB), just in relation to the DB file I think it is huge.

like image 866
Kyle West Avatar asked Dec 05 '22 07:12

Kyle West


1 Answers

Er... excuse the bleeding obvious, but do you have scheduled backups with "BACKUP LOG"

If the recovery model is FULL then this needs to happen.

There are other, rare options that I'll include (not exhaustive):

  • Large table index rebuild/maintenance. However, backup log will clear this.
  • An open transaction preventing backup log removing entries (hence it grows)
  • A connection with SET IMPLICIT_TRANSACTIONS ON (see previous point)
like image 72
gbn Avatar answered Jan 06 '23 16:01

gbn