Sql-server – SQL Server: Log file grows more and more, and do not get merged with the MDF file

databasesql serversql-server-2008transaction-log

My database files look very suspicious. we are using the DB in a production stage. and I'm seeing how the LDF file grows more and more. while the MDF file seems as it is not growing at all (I don't have a file size history to demonstrate it, but I think it is not doing it!! I bet!)

So I guess what could be happening? How could I force the merge to the MDF?

Best Answer

Are you taking periodic log backups? Like every 30 mins? Either start taking log backup, or change the recovery model to simple.

You can always see the reaosn which holds the log resuse in sys.databases , the log_reuse_wait_desc column:

Description of reuse of transaction log space is currently waiting on one of the following:

  • NOTHING
  • CHECKPOINT
  • LOG_BACKUP
  • ACTIVE_BACKUP_OR_RESTORE
  • ACTIVE_TRANSACTION
  • DATABASE_MIRRORING
  • REPLICATION
  • DATABASE_SNAPSHOT_CREATION
  • LOG_SCAN
  • OTHER_TRANSIENT

For more information, see Factors That Can Delay Log Truncation.