onstat -s Latches
The onstat -s command displays the latches that are currently being held by userthreads for resources in
Latches with lock or userthread set
name address lock wait userthread
physlog 4ebdf368 0 3dbc77d20 3dca48d20
physb1 4ebdf3e0 0 3dca48d20 3dc7bdaa8
physb2 4ebdf4e0 0 0 3dca48d20
||The name of the resource upon which a latch has been acquired.
altlatch Alter table counter
bh[#] Hash buffer
flushctl Flusher control
flushr# Page cleaners
locks Lock table
lh[#] Lock hash
lockfr Lock free list
lockdl Deadlock list
loglog Logical Log
LRU# LRU queue
physb1 Physical Log buffer 1
physb2 Physical Log buffer 2
physlog Physical Log
pt Tblspace tblspace
tblsps Tblspace table
trace Trace buffer
txlk[#] Transaction list
users User table
userthreads User list
onstat -g amx
onstat -g lmx
onstat -g wmx
||The in-memory address of the latch.
||Indicates if the lock on the resource is set. The code that indicates the lock status (1 or 0) is machine dependent
||The first address of the thread waiting for this resource.
||The address of the userthread holding the latch.
Latches are a method for controlling simultaneous access to shared memory resources.
The userthread address can be used with
onstat -u command to track the user
To obtain the rstcb address from the tcb address, examine the output of the
onstat -g ath command, which lists both
addresses for each user thread.
Monitoring and Tuning
Latches are grabbed and released very rapidly. As such, you generally
will not see the same latch being held by the same thread if you run the onstat command a second time.
The number of latches (mutexes) required can be reduced by using one CPU VP and setting the value of
SINGLE_CPU_VP to 1 in the configuration file when working on a one or two CPU machine.
Another method for monitoring mutexes is through the MT commands amx,
lmx and wmx, which show
all mutexes, locked mutexes and mutexes with waiters.