Skip to content

Est. 2011ยทMicrosoft Partner 7033487ยทDelivery under 3 minยทSupport 7 days a week

Your vault is empty.

Free Fix 9002

Error 9002: The Transaction Log Is Full – Find the log_reuse_wait Reason

13 min read Updated October 5, 2026 SQL Server

Fix it now

The log has no space it is allowed to reuse, which is not the same as being full of live transactions and is almost never fixed by shrinking. SQL Server will tell you what is holding it if you ask: the message itself points at log_reuse_wait_desc in sys.databases, and that one column turns this from guesswork into a two-minute diagnosis.

Run these first. The second column of the first query decides everything

SELECT name, recovery_model_desc, log_reuse_wait_desc FROM sys.databases WHERE name = N'MyDb';
DBCC SQLPERF(LOGSPACE);
  1. LOG_BACKUP: take one. BACKUP LOG [MyDb] TO DISK = N'D:\bk\MyDb_log.trn'; then re-check the column. A database whose log has never been backed up may need two before space is released.
  2. ACTIVE_TRANSACTION: find it. USE MyDb; DBCC OPENTRAN; then decide whether to wait for it or end it.
  3. CHECKPOINT: run one. CHECKPOINT; then examine the virtual log files with SELECT * FROM sys.dm_db_log_info(DB_ID(N'MyDb'));
  4. REPLICATION: check the log reader agent or the change data capture job is running and caught up.
  5. Only if the volume itself is out of space, add a second log file on another volume as a temporary measure, then remove it once the real cause is cleared.

Shrinking is not a solution to a full log. It only reclaims physical space that is already free inside the file, so the log has to be truncated first and the file will grow straight back if the cause is untouched.

If log_reuse_wait_desc now reads NOTHING and writes succeed, you are done. If it still names something, the next section explains what each value is telling you.

Why it happens

The transaction log is used circularly. Internally it is divided into virtual log files, and each one becomes reusable when every record in it is no longer needed for recovery, replication, backup, or any other consumer. Truncation is the act of marking them reusable; it does not shrink the file and it does not delete anything you can see. When no virtual log file can be marked reusable and the physical file cannot grow, you get 9002.

The distinction between truncation and shrinking is the one that saves the most time. Truncation is a logical operation that frees space inside the file for reuse. Shrinking is a physical operation that returns space to the file system. Shrinking cannot help a full log, because there is no free space inside the file to return, and Microsoft’s own page says so directly. Worse, the data moved during a shrink is scattered wherever there is room, which fragments indexes and slows the queries that scan them.

In simple recovery a checkpoint is enough to release the space. In full or bulk-logged recovery nothing is released until a log backup is taken, and this is by a wide margin the most common cause of 9002: a database left in full recovery because that is the default, with nobody ever backing up its log. The file then grows until the disk stops it.

Every other reason is some consumer holding the records. An open transaction pins everything written since it began, however small it is. Replication and change data capture hold records until the reader has processed them. A running backup or restore, an availability replica that has fallen behind, or a snapshot being created will each hold the log briefly. Every one of those has its own value in log_reuse_wait_desc, which is why reading that column first saves an hour.

Full recovery model with no log backups

You have this one if recovery_model_desc is FULL, log_reuse_wait_desc is LOG_BACKUP, and there is no log backup history in msdb.

  1. Decide what this database actually needs. If point-in-time recovery matters, schedule log backups; if it does not, simple recovery is the honest choice.
  2. To keep full recovery, back the log up now and then schedule it, typically every fifteen to sixty minutes depending on how much work you can afford to lose.
  3. Take a second log backup if the first does not release space. Microsoft notes that a database whose log has never been backed up may need two.
  4. Confirm the space came back: re-run the sys.databases query and DBCC SQLPERF(LOGSPACE);

Log backups are what makes full recovery meaningful. A database in full recovery with no log backups gives you a growing file and no extra recoverability at all.

An open transaction is pinning the log

You have this one if log_reuse_wait_desc reads ACTIVE_TRANSACTION and DBCC OPENTRAN returns a session that has been open a long time.

  1. Identify what it is doing: SELECT session_id, status, command, last_request_start_time FROM sys.dm_exec_requests WHERE session_id = <spid>;
  2. Cross-check with sys.dm_tran_database_transactions for the transaction’s own view of itself.
  3. Contact whoever owns it. A forgotten BEGIN TRANSACTION in a query window is a common culprit.
  4. If it must be ended, KILL rolls it back, and the rollback itself takes time and log space.

Look for the pattern behind it as well as the session: transactions held open across user interaction, or across a slow external call, will do this again next week.

No checkpoint has happened since the last truncation

You have this one if log_reuse_wait_desc reads CHECKPOINT, or INDIRECT_CHECKPOINT on a database with a target recovery time set.

  1. Run CHECKPOINT; in the affected database.
  2. Examine the virtual log files: SELECT * FROM sys.dm_db_log_info(DB_ID(N'MyDb')); The head of the log may not have moved beyond one VLF.
  3. For INDIRECT_CHECKPOINT, this should be short-lived. If it is not, ALTER DATABASE [MyDb] SET TARGET_RECOVERY_TIME = 0 SECONDS; disables indirect checkpoints temporarily.
  4. Re-check the column afterwards.

Replication or change data capture is behind

You have this one if log_reuse_wait_desc reads REPLICATION, sometimes long after replication was supposedly removed.

  1. Confirm whether the database is genuinely published or has change data capture enabled: SELECT name, is_published, is_cdc_enabled FROM sys.databases;
  2. Start or restart the log reader agent, or the capture job for change data capture, and let it catch up.
  3. Check the oldest non-distributed transaction if replication is genuinely in use.
  4. If a feature was removed but its metadata remains, complete the removal properly rather than leaving the log pinned.

The volume is out of space or the file has hit its maximum

You have this one if The wait description offers nothing useful and the log file cannot grow.

  1. Check the settings: SELECT name, size/128 AS size_mb, max_size, growth, is_percent_growth FROM sys.database_files WHERE type_desc = 'LOG';
  2. Raise or remove a maximum size that is too low, and replace percentage growth with a fixed increment in megabytes.
  3. Add a temporary second log file on a volume with space: ALTER DATABASE [MyDb] ADD LOG FILE (NAME = N'MyDb_log2', FILENAME = N'E:\Log\MyDb_log2.ldf', SIZE = 81920KB, FILEGROWTH = 65536KB);
  4. Remove it once the real cause is cleared and the original log has reusable space again.

Microsoft’s wording is that multiple log files should be considered a temporary condition to resolve a space issue, and an advanced troubleshooting step rather than a configuration.

Full reference

Reading log_reuse_wait_desc, every documented value

Value What it means What to do
NOTHING Nothing is holding the log If 9002 persists, the volume is full or the file has hit its maximum
CHECKPOINT No checkpoint since the last truncation, or the head of the log has not moved beyond a VLF Run CHECKPOINT, then inspect sys.dm_db_log_info()
LOG_BACKUP A log backup is required before the log can be truncated Take one. Take two if the log has never been backed up
ACTIVE_BACKUP_OR_RESTORE A backup or restore is running Wait for it, or cancel it if it is stuck
ACTIVE_TRANSACTION A long-running active or deferred transaction DBCC OPENTRAN, then sys.dm_tran_database_transactions
DATABASE_MIRRORING Mirroring is paused, or the mirror is behind the principal Check mirroring status, unsent log and send rate
REPLICATION Transactions not yet delivered to the distribution database Check the Log Reader Agent and the oldest non-distributed transaction
SNAPSHOT_CREATION A database snapshot is being created Routine and brief. Let it finish
LOG_SCAN A log scan is in progress Routine and brief
AVAILABILITY_REPLICA A secondary has not hardened the changes yet Check availability group health and replica synchronisation
INDIRECT_CHECKPOINT The oldest page is older than the checkpoint LSN Should be short-lived. TARGET_RECOVERY_TIME = 0 SECONDS disables it temporarily
IN_MEMORY_OLTP_CHECKPOINT No In-Memory OLTP checkpoint since the last truncation Run CHECKPOINT. An automatic one is taken when the log passes 1.5 GB

The neighbouring codes and what each adds

Code Published meaning
3619 Could not write a checkpoint record in the database because the log is out of space
5901 One or more recovery units failed to generate a checkpoint. Typically lack of disk or memory, and in some cases database corruption. Examine earlier error log entries
1833 A file cannot be reused until after the next BACKUP LOG operation. In an availability group, a dropped file can only be reused after the primary’s truncation LSN passes the drop LSN and a log backup completes
3023 Backup, file manipulation operations such as ALTER DATABASE ADD FILE, and encryption changes must be serialised. Reissue after the current operation completes
8985 Could not locate the named file for the database in sys.database_files. The file either does not exist or was dropped

5901 is the one worth not skipping. Its published text names database corruption as a possibility alongside resource shortage, and it tells you to read the earlier entries in the error log. A checkpoint failure that keeps recurring on a database with plenty of disk is a reason to run DBCC CHECKDB, not a reason to add another log file.

Shrinking, and when it is legitimate

  • Truncation frees space inside the file for reuse. Shrinking returns free space to the file system. They are different operations and only one of them is relevant to a full log.
  • Shrinking cannot work unless there is already empty space inside the log file, which means the log has to be truncated first.
  • Shrinking happens at virtual log file boundaries, so the result rarely matches the size you asked for.
  • Microsoft warns that data moved to shrink a file is scattered to any available location, which fragments indexes and can slow range queries. Consider rebuilding indexes on the file afterwards.
  • Shrink once, deliberately, after the underlying cause is fixed and only if the file is genuinely oversized. Never on a schedule.

Sizing the log so this stops happening

Size it for the busiest transaction you run plus the work generated between two log backups, and set it up front rather than reaching it through autogrow. Watch used_log_space_in_percent in sys.dm_db_log_space_usage across a normal week and size for the peak, not for the average. Use a fixed growth increment in megabytes rather than a percentage, because a percentage of a large file is an unpredictable increment that arrives at the worst possible moment.

Switching a database to simple recovery to force the log to clear breaks the log backup chain immediately. Everything since your last full backup becomes unusable for point-in-time recovery. If you do it deliberately, take a full backup straight afterwards and accept the gap.

Every code this article covers

Code What it points at Source
9002 The transaction log for the database is full. The message itself points at log_reuse_wait_desc in sys.databases for the reason Microsoft Learn
3619 Could not write a checkpoint record in the database because the log is out of space Microsoft Learn
5901 One or more recovery units belonging to the database failed to generate a checkpoint. Typically a shortage of disk or memory, and in some cases database corruption Microsoft Learn
1833 A file cannot be reused until after the next BACKUP LOG operation, with an extra rule about truncation and drop LSNs when the database is in an availability group Microsoft Learn
3023 Backup, file manipulation operations and encryption changes on a database must be serialised. Reissue the statement after the current one completes Microsoft Learn
8985 Could not locate the named file for the database in sys.database_files. The file either does not exist or was dropped Microsoft Learn

Confirm the fix worked

  1. Re-run SELECT name, log_reuse_wait_desc FROM sys.databases WHERE name = N'MyDb'; and confirm it reads NOTHING.
  2. Run DBCC SQLPERF(LOGSPACE); and confirm the used percentage has dropped.
  3. Run a write that previously failed and confirm it completes.
  4. Confirm the log backup job is scheduled and succeeding if the database is in full recovery.
  5. If you added a second log file, confirm it has been removed once the original log has reusable space.

Questions people ask about this

Does fixing 9002 cost money?

Not in licensing terms. Log backups, recovery models and file management are core features of every edition. The only cost that can appear is disk, if the log genuinely needs to be larger than the volume it sits on.

Should I just shrink the log?

Shrinking cannot fix a full log. It only returns space that is already free inside the file, so the log has to be truncated first, and if the underlying cause is untouched the file grows straight back. Microsoft also warns that the data movement fragments indexes. Fix the reason first, then shrink once if the file is genuinely oversized.

I took a log backup and the space did not come back. Now what?

Take a second one. Microsoft notes that a database whose log has never been backed up may need two log backups before space is released. If the value still reads LOG_BACKUP after that, check whether another job or product is also backing up this log and taking half the chain.

Is a second log file a good permanent solution?

No. Microsoft’s own wording is that multiple log files should be considered a temporary condition to resolve a space issue and an advanced troubleshooting step. Remove it once the underlying cause is cleared.

How large should the log be?

Large enough for your busiest transaction plus the work between two log backups, sized up front rather than reached through autogrow. Watch used_log_space_in_percent in sys.dm_db_log_space_usage across a normal week and size for the peak.

Related error codes

Was this article helpful?

Your feedback helps us improve our documentation.

Related articles

License Error Error 18401 and 17187: SQL Server Is Not Ready to Accept Connections Free Fix Error 7202: Linked Server Missing From sys.servers and Ad Hoc Query Blocks Free Fix MSI Error 1603 and 1618: SQL Server Tools and Update Installs Keep Failing Free Fix SSIS Error 0xC020801C: Cannot Acquire Connection From Connection Manager
โ† Back to Knowledge Base