What it means
-904 is Db2's general error for something it can't get to right now. The statement itself is fine. Something outside the program got in the way, and the message gives three tokens that tell you what.
- The reason code, an 8-digit hex code such as 00C90096, says why the resource was unavailable.
- The resource type says what kind of thing it was. 00000200 is a table space, 00000201 an index space and 00000302 a page in a table space.
- The resource name names it, such as PAYDB.PAYTS01 for a table space, with the page number in hex added for a page.
-904 doesn't roll back the unit of work. Only the failing statement is affected, and the program decides whether to retry, roll back or stop.
One reason code comes up often enough to know by heart. 00C90096 means the program holds more locks than the subsystem allows for one user, the NUMLKUS limit. For other codes, look them up in the Db2 codes manual for your release.
Common causes
- The table space, index space or partition is stopped, for example by a -STOP DATABASE command for maintenance.
- The object is in a restricted status that blocks the access, such as RECOVER-pending, REBUILD-pending, CHECK-pending or REORG-pending. COPY-pending blocks updates but still allows reads.
- A utility such as REORG, LOAD or RECOVER is working on the object, or stopped partway and still holds it.
- A data set can't extend, because its volumes are full, it reached its extent limit, or the table space is at its maximum size.
- A batch program updated a large number of rows without a COMMIT and ran into the lock limit per user (reason 00C90096).
- Pages are in the logical page list (LPL) after an error, so Db2 won't use them until they're recovered.
How to find the problem
- Note the reason code, resource type and resource name from the DSNT408I message or SQLERRMC.
- Run
-DISPLAY DATABASE(PAYDB) SPACENAM(PAYTS01) RESTRICTto see whether the object is stopped or in a restricted status. Adding LOCKS instead of RESTRICT shows who holds locks on it. - Run
-DISPLAY UTILITY(*)to see whether a utility is active on the object, including one that stopped and still holds it. - Look in the Db2 master address space log (the xxxxMSTR job) at the same time. DSNT501I repeats the reason code with the job's correlation ID, and DSNP007I reports a data set that failed to extend.
- Look up the reason code in the Db2 codes manual for your release. It names the exact condition Db2 hit.
How to fix it
- Once the underlying problem is fixed, start the object with
-START DATABASE(PAYDB) SPACENAM(PAYTS01) ACCESS(RW). - Clear a restricted status with the utility it calls for, such as COPY for COPY-pending, REORG for REORG-pending or RECOVER for RECOVER-pending.
- For space problems, have the storage team or DBA add volumes, raise PRIQTY and SECQTY, or move the object to a larger data set size, then rerun.
- For 00C90096, commit more often in the program. The DBA can also lower LOCKMAX or change LOCKSIZE so Db2 escalates to a table space lock before the limit is reached.
- Keep batch updates out of utility windows, and give programs retry logic for short outages.
What it looks like
PAYUPD1 - UPDATE EMP_HIST FAILED, EMPNO 0047113
DSNT408I SQLCODE = -904, ERROR: UNSUCCESSFUL EXECUTION CAUSED BY AN UNAVAILABLE RESOURCE.
REASON 00C90096, TYPE OF RESOURCE 00000302, AND RESOURCE NAME
PAYDB.PAYTS01.X'0001A4'
DSNT418I SQLSTATE = 57011 SQLSTATE RETURN CODE