SYSIBMTS.TSLOCKS view
You can view command lock information at the database and index level using SYSIBMTS.TSLOCKS.
Column name | Data type | Nullable? | Description |
---|---|---|---|
COMMAND | VARCHAR(30) | NO | Name of the command that created the lock. Possible values are: CREATE INDEX, ALTER INDEX, DROP INDEX, UPDATE INDEX, CLEAR EVENTS, DISABLE DATABASE, CONFIGURE, CLEANUP |
LOCKSCOPE | VARCHAR(30) | NO | Scope of the lock. Possible values are: DATABASE or INDEX. |
INDSCHEMA | VARCHAR(128) | NO | Schema name of the text search index (only for LOCKSCOPE = INDEX) |
INDNAME | VARCHAR(128) | NO | Unqualified name of the text search index (only for LOCKSCOPE = INDEX) |
PARTITION | INTEGER | NO | Partition number on which the text search lock is created |
LOCKCREATETIME | TIMESTAMP | NO | Time stamp when the lock was granted |
There are three distinct scenarios
to be aware of for locking strategies:
- An operation is started and no applicable lock is encountered: The procedure sets the lock and continues execution. For both successful and failed execution, the lock is removed.
- An operation is started and encounters an applicable lock: The request is returned with a conflicting command message.
- An operation is started and encounters an applicable lock, even though no associated operation is currently running: A failure occurred for an earlier operation that prevented proper removal of the lock. This can occur in extreme situations like disk failures or crashes. In such a case the locks need to be removed by issuing a CLEAR COMMAND LOCKS operation at the index or database level as appropriate, after the cause of failure is addressed and system consistency is verified.