Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Locking > Monitoring and Administering Locks >

Monitoring Locks

You can view the lock table with onstat -k. Figure 39 shows sample output for onstat -k.

Figure 39. onstat -k Output
Locks
address  wtlist   owner    lklist   type     tblsnum  rowid    key#/bsiz
300b77d0 0        40074140 0        HDR+S    10002    106        0
300b7828 0        40074140 300b77d0 HDR+S    10197    123        0
300b7854 0        40074140 300b7828 HDR+IX   101e4    0          0
300b78d8 0        40074140 300b7854 HDR+X    101e4    102        0
 4 active, 5000 total, 8192 hash buckets 

In this example, a user is inserting one row in a table. The user holds the following locks (described in the order shown):

To determine the table to which the lock applies, execute the following SQL statement. For tblsnum, substitute the value shown in the tblsnum field in the onstat -k output.

SELECT tabname 
FROM systables
WHERE partnum = hex(tblsnum)

You can also query the syslocks table in the systables database to obtain information on each active lock. The syslocks table contains the following columns.

Column
Description
dbsname
Database on which the lock is held
tabname
Name of the table on which the lock is held
rowidlk
ID of the row on which the lock is held (0 indicates table lock)
keynum
The key number for the row
type
Type of lock
owner
Session ID of the lock owner
waiter
Session ID of the first waiter on the lock
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]