Guide · SQL Server

Why the SQL Server transaction log grows and how to keep it under control

A 5 GB database with an 80 GB log file: a familiar sight for many companies that run SQL Server. The log does not shrink by itself and can end up filling the disk. This guide explains why the log grows, how to find the cause and how to keep it under control for good.

Doz Teknoloji · Updated November 21, 2026 · 7 min read

What the transaction log is for

Every SQL Server database has a data file (.mdf) and a transaction log (.ldf). Every change is written to the log first. SQL Server uses these records to bring the database back to a consistent state after a crash, to roll back unfinished transactions and to restore to a point in time.

The log works like a ring: once its records are no longer needed, the space can be reused. The log only grows when this reuse is blocked for some reason. So the real question is not "why is the log growing?" but "why can the log space not be reused?"

The recovery model: the most common cause

Every database has a recovery model:

The most common situation: the database is in the Full model, a full backup runs every night, but no log backup is ever taken. A full backup does not free log space, so the log grows a little more every day. The fix is either regular log backups (for example every 15 to 60 minutes), or, if you do not need point-in-time restores, the Simple model.

Ask SQL Server for the cause

SQL Server tells you why it cannot reuse the log space:

SELECT name, recovery_model_desc, log_reuse_wait_desc
FROM sys.databases;

The most common values of log_reuse_wait_desc:

To see how full the log is, use DBCC SQLPERF(LOGSPACE);.

Getting it under control, step by step

  1. Find the cause. Check log_reuse_wait_desc with the query above.
  2. If it is LOG_BACKUP, set up log backups. For example: BACKUP LOG [DatabaseName] TO DISK = N'E:\Backup\DatabaseName_log.trn'; Run it regularly with a maintenance plan or a SQL Server Agent job, and make sure the backups are copied to another disk or server.
  3. If it is ACTIVE_TRANSACTION, find the open transaction. DBCC OPENTRAN; shows the oldest one. Find out why the application does not close it.
  4. Once the log can be reused, shrink it once if needed. If the log grew far beyond what it will ever need again, shrink it to a sensible size: DBCC SHRINKFILE (N'DatabaseName_log', 4096); (in MB).
  5. Set the growth step. Growing the log by a fixed amount (for example 512 MB or 1 GB) instead of a percentage avoids a large number of small virtual log files (VLFs). Many VLFs can slow down startup and restores; on SQL Server 2016 SP2 and later you can count them with sys.dm_db_log_info.

Why shrinking on a schedule is not a fix

A job that shrinks the log regularly looks tempting but solves nothing. If the cause remains, the log grows back to the same size, and every growth makes writes wait while SQL Server zeroes the new space. In the Full model, emptying the log without a log backup also takes away the ability to restore to a point in time. The lasting fix is to remove the cause and let the log stay at the size it needs.

Monitoring the log continuously

Log problems are usually noticed when the disk is full, with error 9002 "the transaction log is full". Secura RMM watches the log usage and the last log backup of every database, without signing in to SQL Server, from the event log and performance counters. It alerts you when log backups stop or log usage passes 90% by default. See SQL Server monitoring for details.

Frequently asked questions

Does a full backup shrink the log?

No. A full backup does not free log space. In the Full model, log space becomes reusable only after a log backup.

Is switching to the Simple model safe?

Yes, if you do not need point-in-time restores and returning to the last full or differential backup is enough. It is a business decision; first agree how much data loss you can accept.

Can I delete the log file?

No. The log file is part of the database; deleting it can leave the database unable to open. Always shrink it with the steps above.

Related: SQL Server monitoring · Password attempts on SQL Server · Alerts