onstat -s Latches

The onstat -s command displays the latches that are currently being held by userthreads for resources in shared memory.

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

Output Description

Heading Description Format See Also
name The name of the resource upon which a latch has been acquired.
   Name        Description
   altlatch    Alter table counter
   archive     Archive
   bf[#]       Buffer 
   bh[#]       Hash buffer 
   chunks      Chunks
   ckpt        Checkpoints
   DBSpace     DBSpace
   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
   timestamp   Timestamp
   trace       Trace buffer
   trans       Transactions
   txlk[#]     Transaction list
   users       User table
   userthreads User list
Str onstat -u
onstat -g amx
onstat -g lmx
onstat -g wmx
address The in-memory address of the latch. Hex  
lock Indicates if the lock on the resource is set. The code that indicates the lock status (1 or 0) is machine dependent Dec  
wait The first address of the thread waiting for this resource. Hex  
userthread The address of the userthread holding the latch. Hex onstat -u

Notes

    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.