Low severityresource
SQL Server Error:
9002
What does this error mean?
SQL Server error 9002 means the transaction log for a database has reached its maximum allocated size and cannot accept new writes. Every INSERT, UPDATE, DELETE, and DDL statement fails immediately with this error until log space is reclaimed. In a data-pipeline context this surfaces as ADF pipeline failures on Copy or Stored Procedure activities, Fabric dataflow errors, and Power BI dataset refresh failures — all hitting the same database simultaneously. The root cause is almost always a missing log backup in FULL recovery model, a long-running transaction holding the log open, or a disk/file-size ceiling that prevents the log file from growing.
Common causes
- 1Log backup job has not run in FULL or BULK_LOGGED recovery model: SQL Server cannot reuse log space until a transaction log backup confirms those log records are safely stored elsewhere. If the scheduled SQL Agent job or ADF backup activity missed a run, the log fills up within hours on a busy OLTP database.
- 2Long-running or open transaction is blocking log truncation: A BEGIN TRANSACTION that was never committed or rolled back, or a distributed transaction left open by a failed ADF pipeline, holds an active log record that prevents any earlier log space from being reused — even after a log backup runs.
- 3Log file autogrowth is disabled or the disk is full: If the log file has a hard MAXSIZE set (e.g. 10 GB) or the volume it lives on has no free space, autogrowth cannot kick in and the log hits its ceiling. This is common on shared SAN volumes or developer instances with fixed disk quotas.
- 4Replication or Change Data Capture is enabled and lagging: When CDC or transactional replication is configured, the log cannot truncate past the oldest unscanned LSN. If the Log Reader Agent or CDC capture job falls behind — common during high-volume bulk loads — the entire log history accumulates until the agent catches up.
- 5Database mirroring or Availability Group synchronization is paused: In an AG or mirroring setup, log hardening on the secondary must complete before the primary can truncate. If the secondary is unreachable, disconnected, or in SUSPENDED state, the primary log grows unbounded until the secondary reconnects or the session is removed.
- 6Bulk load operation without intermediate checkpoints: A single large BULK INSERT or bcp import inside a FULL recovery database generates a proportionally large log entry. Without intermediate commits or a separate log backup mid-load, the log can fill completely before the operation finishes.
- 7VLF fragmentation causing log space waste: Excessive Virtual Log Files from repeated small autogrowth events can cause SQL Server to report the log as 'full' even when a portion of VLFs are technically inactive — because the log file metadata overhead itself consumes space that cannot be reused without a shrink cycle.
How to fix it
- 1Step 1 — Identify why the log cannot truncate: SELECT name, recovery_model_desc, log_reuse_wait_desc FROM sys.databases WHERE name = DB_NAME(); The log_reuse_wait_desc column tells you the exact blocker: LOG_BACKUP (need a backup), ACTIVE_TRANSACTION (open txn), REPLICATION or CDC (capture lag), AVAILABILITY_REPLICA (AG sync stalled), etc. Fix the right cause — not just the symptom.
- 2Step 2 — If log_reuse_wait_desc = LOG_BACKUP, run a log backup immediately: BACKUP LOG [yourdb] TO DISK = 'NUL' WITH STATS = 10; Using NUL frees space right now without needing a real backup device; replace with a real path for retention. After the backup completes, SQL Server marks inactive VLFs as reusable and write operations resume.
- 3Step 3 — If log_reuse_wait_desc = ACTIVE_TRANSACTION, find and kill the blocker: SELECT session_id, start_time, status, command, blocking_session_id, wait_type, open_transaction_count, text FROM sys.dm_exec_requests CROSS APPLY sys.dm_exec_sql_text(sql_handle) WHERE open_transaction_count > 0; Then KILL <session_id>; — confirm with the application owner before killing sessions in production.
- 4Step 4 — If disk or file size is the ceiling, expand the log file or add a secondary log file: ALTER DATABASE [yourdb] MODIFY FILE (NAME = yourdb_log, SIZE = 20480MB, MAXSIZE = UNLIMITED); Or, if the current volume has no space, add a log file on a different drive: ALTER DATABASE [yourdb] ADD LOG FILE (NAME = yourdb_log2, FILENAME = 'D:\logs\yourdb_log2.ldf', SIZE = 5120MB, MAXSIZE = UNLIMITED, FILEGROWTH = 512MB);
- 5Step 5 — If log_reuse_wait_desc = REPLICATION or CDC, check agent lag: EXEC sp_repldone @xactid = NULL, @xact_seqno = NULL, @numtrans = 0, @time = 0, @reset = 1; — use only if the publication is being removed or rebuilt. Otherwise restart the Log Reader Agent or CDC capture job and monitor DBCC OPENTRAN([yourdb]) to confirm the oldest active replication LSN is advancing.
- 6Step 6 — If in an Availability Group with a stalled secondary, check replica state: SELECT replica_id, synchronization_state_desc, synchronization_health_desc, log_send_queue_size FROM sys.dm_hadr_database_replica_states; If the secondary is SUSPENDED, resume with: ALTER DATABASE [yourdb] SET HADR RESUME; If the secondary is permanently unavailable, consider removing it from the AG temporarily to unblock the primary log.
- 7Step 7 — After the immediate crisis is resolved, shrink the log file back to a sane size and schedule preventive maintenance: DBCC SHRINKFILE (yourdb_log, 1024); — this reclaims the now-empty space. Then create or verify a SQL Agent job running BACKUP LOG every 15–30 minutes for busy databases, and set log file autogrowth to at least 256 MB increments with MAXSIZE = UNLIMITED.
Example log output
SqlException: The transaction log for database 'OperationsDB' is full due to 'LOG_BACKUP'. (Microsoft SQL Server, Error: 9002)ADF Activity 'Copy_FactSales' failed: ErrorCode=SqlException, Message=The transaction log for database 'OperationsDB' is full due to 'ACTIVE_TRANSACTION'., Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryExceptionMsg 9002, Level 17, State 4, Line 1 — The transaction log for database 'DW_Staging' is full due to 'REPLICATION'.