Db2 Troubleshooting
SQLCODE -913 during batch update
SQLCODE -913: resource unavailable — the object you need is in a restrictive state or held by a utility.
What it means
- After every EXEC SQL, DB2 returns a SQLCODE: 0 means success, +100 means no row found, and negative values mean an error.
Common causes
- Table space in COPY-pending, REORG-pending or another restrictive state.
- A utility (LOAD, REORG, RECOVER) holds the object.
- Dataset for the table space is unavailable.
How to diagnose
- Check the table space status: -DISPLAY DATABASE(name) SPACENAM(*).
- Look for running utilities on that object.
- Check for -904 companion messages naming the resource.
How to fix it
- Clear the restrictive state: run the required utility (e.g. COPY after LOAD).
- Wait for or reschedule around the conflicting utility.
- Restart the database object if the dataset is the issue.
Example: Display object status
-DISPLAY DATABASE(PAYDB) SPACENAM(*) USE
*> shows status like COPY-pending or RECOVER-pending
Restrictive states are cleared by running the pending utility.
Interview tip
- Q: How would you troubleshoot a SQLCODE -913 during batch update in production?
- A: I would check the SQLCODE and SQLERRM immediately after the failing statement, reproduce in SPUFI, then apply the specific fix.
Prevention checklist
- Always check SQLCODE after every EXEC SQL statement.
- Log the SQLCODE, SQLSTATE and failing statement for support.
