DB2 SQLCODE -911 means your unit of work lost a locking fight and DB2 rolled it back. The fight was either a deadlock cycle or a lock wait that exceeded the timeout. This how-to shows how to read the reason code, gather DSNT376I and DISPLAY evidence, decide between deadlock and timeout playbooks, verify the diagnosis, and avoid unsafe retries.
When DB2 returns -911, three facts matter immediately. First, the current unit of work is gone: uncommitted changes since the last commit were rolled back. Second, the cause was deadlock or timeout, not a syntax problem. Third, the reason code, resource type, and resource name tell you which story you are in. SQLSTATE 40001 marks the transaction-rollback class.
People often say "we deadlocked" whenever they see -911. That shorthand hides timeouts. A timeout means one holder kept a lock longer than the waiter was allowed to wait. A deadlock means two or more waiters formed a circle and IRLM broke the circle by choosing a victim. Both hurt availability. Only one is solved by consistent lock ordering alone.
Also keep -913 in mind. It reports deadlock or timeout without the same automatic unit-of-work rollback semantics as -911. Bind options and environment decide which code an application sees. Your diagnosis still starts with reason code and resources; your recovery code must know which SQLCODE your plans are configured to return.
| Reason | Meaning | Diagnosis focus |
|---|---|---|
| 00C90088 | Deadlock detected; victim UOW rolled back | Find the cycle and fix lock order |
| 00C9008E | Lock wait exceeded timeout interval | Find the long holder or shorten waits |
Capture the SQLCA fields and any printed message text. Do not assume later statements in the same logical business unit still have their database changes. After -911 they do not. If the program continues as if only one statement failed, you can create logic errors that are worse than the original lock wait.
123456789Minimum capture for -911: SQLCODE / SQLSTATE reason-code (often in SQLERRD(3) and message text) resource-type resource-name plan / package / section if available correlation-id, connection-id, LUW-id member name (data sharing) timestamp
If the reason is 00C90088, follow the deadlock playbook: identify both participants and the conflicting resource order. If the reason is 00C9008E, follow the timeout playbook: identify the long holder, the waiter, and why the lock was held past the timeout interval (long UOW, missing commit, utility drain, held cursor, or overloaded system).
Write the branch explicitly in the incident record. Mixing the playbooks leads to useless changes such as "increase timeout" for a true deadlock cycle, or "swap update order" when one batch job simply never commits.
Search for DSNT376I and related messages in the failure window. Note the correlation IDs for the requestor and holder. In data sharing, note the member names. If users are still waiting, issue displays before the situation clears.
123-DISPLAY THREAD(*) TYPE(ACTIVE) -DISPLAY DATABASE(APPDB) SPACENAM(PAYTS) LOCKS -DISPLAY DATABASE(APPDB) SPACENAM(PAYTS) CLAIMERS
When the failure already ended, DISPLAY may show nothing interesting. That is normal. Historical messages and monitor deadlock or timeout reports become authoritative. Save those outputs with the ticket so a later reviewer can replay your reasoning.
List the SQL statements the victim performed since the last commit. Which tables and indexes did it touch? In which order? Do the same for the partner if you have SQL text or package section information. Deadlocks almost always reduce to incompatible orders or to a hot parent row serialized under high concurrency. Timeouts often reduce to one participant holding locks across too much work.
12345678910UOW reconstruction worksheet: Last successful COMMIT time: ... Statements since COMMIT: 1) UPDATE APP.ACCOUNT ... 2) UPDATE APP.ORDER ... 3) INSERT APP.AUDIT ... Partner held: APP.ORDER (from DSNT376I) Suspected issue: opposite update order / missing intermediate COMMIT
For deadlocks, enforce one lock order across applications and shorten units of work. For timeouts, find and fix the long holder, add commits, reduce held-cursor duration, or adjust utility schedules. Only after measuring should you consider timeout parameter changes, and never as a substitute for a clear cycle.
If the application retries, retry the entire business unit after acknowledging rollback, use exponential or timed backoff, cap the number of attempts, and log every retry with the reason code. Continuing a cursor or assuming earlier inserts still exist after -911 is a defect.
| Symptom | Likely cause | Response |
|---|---|---|
| Retry loop floods -911 | Immediate retries without backoff on the same hot keys | Limit retries, back off, and fix the lock order |
| Developer assumes only one statement failed | Misunderstanding -911 UOW rollback | Redo every change since the last commit |
| Timeout labeled as deadlock | Reason code ignored | Branch diagnosis on 00C90088 vs 00C9008E |
| No locks visible after the abend | Cycle already broken by rollback | Use DSNT376I / IFCID / monitor history |
| Only the victim job is changed | Partner application still uses opposite lock order | Coordinate both participants |
Raising IRLMRWT globally to "make -911 go away" often converts quick failures into longer hangs and can increase time-to-detect for true operational problems. Prefer evidence-based holder reduction and lock-order standards. Parameter changes belong in a capacity conversation after the application defects are understood.
You and a friend both need two toys. Sometimes you each grab a different toy and wait for the other one forever until a teacher cancels your turn and makes you start over. That cancel is SQLCODE -911. Sometimes you just wait too long for one toy because a friend will not share. That is also -911, but with a different reason code. The important part is that when the teacher cancels your turn, none of the toys you thought you placed stay where you left them—you have to begin the game again from the last save point.
1. What does SQLCODE -911 mean?
2. Which reason code indicates deadlock on many -911 failures?
3. After -911, what is true about uncommitted changes in that unit of work?
4. Which message often names holders and waiters around a -911?
5. What is a safe application response pattern after -911?