Informix Error -503: Too many tables locked.
Cause and resolution
Too many tables locked.
This database server in this host operating system has a limit on the number of tables that can be locked at one time. It was unable to lock the table you requested. Roll back the current transaction. Then redesign the operation to lock fewer tables, to use row-level locking, or to open the database in exclusive mode.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-503 is a lock-table capacity error: the server maintains a single lock table shared across all
sessions, sized by the LOCKS ONCONFIG parameter, and a statement that would push the count of
locked tables (or rows, depending on locking mode) past what's available is rejected.
LOCKSsized too small for the workload's actual concurrency and lock-granularity needs — the underlying capacity problem, per the official guidance.- A single transaction touching an unusually large number of tables, each acquiring its own lock, without an obvious need to hold them all simultaneously.
- Table-level locking used where row-level locking would suffice, consuming far more of the lock table than the operation strictly needs.
- The database not opened in exclusive mode for a bulk administrative operation that would otherwise avoid needing per-table locks from the shared pool at all.
Solutions / Resolution
- Roll back the current transaction, per the official guidance — this error leaves the transaction unable to proceed as designed.
- Redesign the operation to lock fewer tables, per the official guidance, if the transaction genuinely doesn't need all of them locked at once.
- Switch to row-level locking on the tables involved, per the official guidance, so the same
operation consumes lock-table entries per row rather than per table:
ALTER TABLE tabname LOCK MODE (ROW); - Or open the database in exclusive mode, per the official guidance, for operations (like bulk administrative work) that can tolerate excluding other sessions instead of competing for shared lock-table capacity.
- If this recurs under normal concurrent load, increase
LOCKSin$ONCONFIGand restart the instance for the new size to take effect.
Examples
Hitting the limit
BEGIN WORK;
-- a transaction touching many tables in a loop
-- -503: Too many tables locked.
ROLLBACK WORK;
Checking current lock-table usage
$ onstat -k
-- review active lock count against the configured LOCKS size
Increasing capacity
# $ONCONFIG
LOCKS 40000
then restart the instance for the change to take effect.
Diagnostic Checks
- Run
onstat -kto see how many locks are currently held and how close the workload runs to the configuredLOCKSceiling. - Check
LOCKSin the active$ONCONFIGto confirm the configured capacity matches what the workload actually needs.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -503 in this set yet.
A lock-table capacity error: fix it by locking less (fewer tables, row-level locking, exclusive
mode) or by sizing LOCKS for the workload.