Using ONSTAT to Find Lock Holders (Informix) 

Below are examples of onstat displays with one user holding a lock and two users waiting on that lock:

onstat -u shows user activity

address

flags

sessid

user

wait

tout

locks

80705758

---P--D

0

informix

0

0

0


807178e0

Y-BP---

86

sapr3

8414a800

0

3



80717c48

L--PR--

89

sapr3

80886930

-1

2



80718318

L--PR--

88

sapr3

80886930

-1

2

80718680

Y--P---

17

sapr3

842e1b40

0

1

onstat -k shows active locks

address

wtlist

owner

lklist

type

tblsnum

80885558

0

80718d50

80885418

S

100002

808862f0

0

80717c48

80887470

IX

a001b3


80886908

0

80718318

0

S

100002

80886930

80886930

807178e0

808878a8

HDR+X

a001b3


808869f8

0

80718318

80886908

IX

a001b3


   

.

   
     

.

   

 

To link the information in the two displays, use the command onstat -u | grep L to look for sessions that are waiting on a lock. Take the value in the column "Wait" and use it to grep in the output of the command onstat -k | grep <wait value> . With the value now displayed in the "Owner" column, you can then return to onstat -u to find out what session is holding the lock. Use the command onstat -u | grep <owner value> .