onstat -k command: Print active lock information

Use the onstat -k command to print information about active locks, including the address of the lock in the lock table.

Figure 1: Syntax:

1  onstat   -k

The maximum number of locks available is specified by the value of the LOCKS configuration parameter in the onconfig file.

Example output
Figure 2: onstat -k command output

Locks
address  wtlist   owner    lklist   type     tblsnum  rowid    key#/bsiz
a095f78  0        a4d9e68  0        HDR+S    100002   203         0   
 1 active, 2000 total, 2048 hash buckets, 0 lock table overflows
In the following output, the number 2 in the last row shows an Enterprise Replication pseudo lock:
Locks 
address  wtlist    owner    lklist   type    tblsnum  rowid    key#/bsiz
a1993e8  0         5c2f03d0 a19be30     S         2   1c05a            0

Output description

address
Is the address of the lock in the lock table

If a user thread is waiting for this lock, the address of the lock shows in the wait field of the onstat -u (users) output.

wtlist
Is the first entry in the list of user threads that is waiting for the lock, if there is one
owner
Is the shared-memory address of the thread that is holding the lock

This address corresponds to the address in the address field of onstat -u (users) output. When the owner value is displayed in parentheses, it represents the shared memory address of a transaction structure. This scenario is possible only when a lock is allocated for a global transaction. This address corresponds to the address field of the output for onstat -G.

lklist
Is the next lock in a linked list of locks that are held by the owner listed
type
Uses the following codes to indicate the type of lock:
HDR
Header
B
Bytes
S
Shared
X
Exclusive
I
Intent
U
Update
IX
Intent-exclusive
IS
Intent-shared
SIX
Shared, intent-exclusive
tblsnum
Is the tblspace number of the locked resource. If the number is less than 10000, it indicates Enterprise Replication pseudo locks.
rowid
Is the row identification number

The rowid provides the following lock information:

  • If the rowid equals zero, the lock is a table lock.
  • If the rowid ends in two zeros, the lock is a page lock.
  • If the rowid is six digits or fewer and does not end in zero, the lock is probably a row lock.
  • If the rowid is more than six digits, the lock is probably an index key-value lock.
key#/bsiz
Is the index key number, or the number of bytes locked for a VARCHAR lock

If this field contains 'K-' followed by a value, it is a key lock. The value identifies which index is being locked. For example, K-1 indicates a lock on the first index that is defined for the table.