How to Fix SQL Server Error 9002 (Msg 9002)
You get sql server error 9002 when a database transaction log runs out of space. You fix it by backing up the log, adding disk space, or stopping open jobs. This failure is a severity 17 problem in the database engine. The engine states that the transaction log for the database is full. It also gives a reason and names the holdup log sequence number. Until you clear this block, the database cannot take any new write tasks. Read tasks will still work, so apps can read data while writes fail. W
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get sql server error 9002 when a database transaction log runs out of space. You fix it by backing up the log, adding disk space, or stopping open jobs.
This failure is a severity 17 problem in the database engine. The engine states that the transaction log for the database is full. It also gives a reason and names the holdup log sequence number. Until you clear this block, the database cannot take any new write tasks. Read tasks will still work, so apps can read data while writes fail.
What causes sql server error 9002 in the engine
Every change to a table goes into the transaction log before the data file. The engine reuses log space only after it marks older log records as inactive. When something stops that cleanup step, active records fill the file until it hits its limit.
The error message tells you the exact reason for the stall. A very common cause is a missing transaction log backup. If a database uses full logging, the log grows until a backup runs. Another common cause is a long write task that keeps the session active for hours. The engine must keep all log entries made since that old task started.
Storage limits also trigger this severity 17 alert during peak hours. Your log file might have a hard size cap set by an admin. Or the disk drive holding the log files might have zero free space left. Replication delays or secondary replica lag can also hold back log reuse. In all cases, the holdup log sequence number marks the oldest needed record.
How to diagnose and fix the log space issue safely
Start by reading the exact reason text inside the error 9002 message. That text tells your team where to look first without guessing. You do not need to give out broad server roles to inspect this state. Avoid adding engineers to the fixed owner role just to check log health. Members of that owner role can change all settings and even drop the database.
If the reason points to a needed log backup, run a standard log backup job. Once the backup finishes, the engine marks old log areas as free for reuse. You do not need to shrink the file right away unless the disk is full. If the error points to an active transaction, find the session holding the lock. Have the app owner commit or roll back that stuck work.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If the disk is full, free up space on that drive first. Delete old local archive files or ask the storage team to expand the volume. You can also add a second log file on a different disk drive. That lets writes start again while you fix the root problem.
How to prevent log growth from breaking production
Good role hygiene helps stop rogue queries from filling up your transaction log. Give most people read access through the fixed data reader role. Those users can read all user tables and views without writing to the log. Only grant the data writer role to accounts that truly need to change data. If an account must never write data, use the deny data writer role.
When a user needs access to just one database, consider a contained database user. An admin must enable contained databases on the server and the database first. This keeps user scope small and avoids extra logins in the master database.
You should also set up alerts on log space used and disk free space. Catching a growing log at eighty percent full gives your team time to act. Check that your scheduled log backups run often and write to healthy storage. Finally, set query timeouts in your apps so broken transactions cannot keeps the session active all day.
Check SQL Server batches and results on the wire
SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server, inline in the TDS wire protocol. On every batch an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Before a batch hits the server, hoop.dev guardrails refuse disallowed actions with a native TDS error or hold risky statements for approval. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns in memory, and every decision is logged. Explore the MIT-licensed project on GitHub.
Frequently asked questions
What does severity 17 mean in sql server error 9002?
Severity 17 means a statement ran out of a configurable resource like log space. The database stays online for reads, and an admin can fix the resource limit.
Can I still read data when error 9002 happens?
Yes, read queries do not write to the transaction log. Users in the data reader role can still read all user tables and views.
What is the holdup LSN mentioned in message 9002?
The holdup LSN is the log sequence number of the oldest active log record. The engine cannot reuse log space past that point until the blocking action finishes.
Related guides
In this post