2

trying to figure out how come my disk space was so low I discovered a log file occupying over 12Gb...

  • is this normal?

  • how do I prevent this from happening again if not?

  • do I just delete it?

Any ideas? Thanks :)

Jon Seigel
  • 468
  • 3
  • 18
RadiantHex
  • 547
  • 2
  • 9
  • 18

2 Answers2

13

If it is a SQL Server .ldf transaction log file, you should not delete it since it would render yor database inoperable (You can't delete it if the database is online).

Assuming it is a database log file, depending on the database recovery mode and autogrow settings, when recovery mode is set to Full or Bulk Logged and autogrow enabled, your transaction log will grow until you execute a transaction log backup.

The easiest way of emptying the transaction log is to set the database recovery mode to Simple, and then shrinking the transaction log, but that will limit your recovery only to full backups.

If it is a production system and you want to be able to do a point in time restore, you need to schedule regular transaction log backups that will clear the transaction log file. It will not decrease the size on disk though, you should shrink it once to a manageable size, then monitor the usage and set it to a size that allows the transaction logs between every backup to be written to the log file without having to grow the file.

Michael Eklöf
  • 519
  • 4
  • 6
1

Here is some reading that will assist you with understanding both what is currently going on in your environment and most importantly what you need to be doing to manage it.

Transaction Log Management

John Sansom
  • 643
  • 3
  • 7