| Previous | Next |
| hrDatabaseLocked | hrTableDuplicate |
hrTableLocked
The object and state that matter
hrTableLocked means the target table is under a lock incompatible with the requested operation.
This is the legacy Directory Service backup/restore HRESULT form of JET_errTableLocked (0xC8000516).
The key comparison is: hrTableInUse concerns active references; this result is specifically the lock conflict. The first useful observation is to record table name, locking session, transaction, schema operation, and open cursor modes. This evidence distinguishes name collisions, stale table handles, active users, locks, and structural dependencies.
Minimum useful trace
- Code-specific observation: record table name, locking session, transaction, schema operation, and open cursor modes.
- the table/object metadata and normalized name; associate it with this result rather than with a later generic exception.
- all JET_TABLEID owners, open modes, transactions, and current indexes; associate it with this result rather than with a later generic exception.
- the exact schema migration step and whether a previous attempt committed.
How to avoid a false diagnosis
hrTableInUse | open cursors or operations prevent an exclusive table change |
|---|---|
hrTableNotEmpty | a clustered-index definition or structural operation requires an empty table but rows already exist |
hrTableDuplicate | table creation reused a name already present in the database |
The ESE objects in play
| Diagnostic layer | table and schema-object ownership, locks, and structural dependencies |
|---|---|
| Typical API surface | JetOpenTable, JetCreateTableColumnIndex, JetDeleteTable, and schema enumeration APIs |
| Code-specific condition | the target table is under a lock incompatible with the requested operation |
| First corrective direction | finish or rollback the owning transaction and reacquire the table in a consistent lock order |
A JET_TABLEID is a cursor-like handle owned by a session, not a persistent table identifier. Schema changes commonly require exclusive access and a specific transaction state.
Safe recovery sequence
- Freeze the failing request context and record
0xC8000516, the Jet API name, and the current instance/session ownership. - Verify the code-specific precondition: record table name, locking session, transaction, schema operation, and open cursor modes.
- Apply the targeted fix: finish or rollback the owning transaction and reacquire the table in a consistent lock order.
- Before retrying the operation, reconcile object definition, exclusive-access state, and migration version.
Actions that can hide or worsen the problem
- Do not force a schema mutation while table users remain active.
- Do not skip a migration merely because an object with the same name exists.
Technical references
- JetOpenTable.
- JetCreateTableColumnIndex
- ESE functions
- JET error codes
- Microsoft: JET_ERR enumeration
Looking for a different code? Search another status or error code.