Find top Informix SQL session by using UNIX pid

Do you have difficulty on finding top informix session by UNIX pid (process id)?

Background:

It is common DBA always been asked “Why informix oninit processes always in UNIX top list? What are they doing?”

In general and with common sense, if an UNIX/Linux box is hosting a (or multiple) Informix database instance(s).   Normally, most of the machine resource (CPU, memory, Disk I/O) will be consumed by Informix instance(s). Oninit processes are the daemons that serve application requests (SQL request) and interact between application and making OS system calls.

Logically, oninit processes can relate to Informix session id.  I have following steps to show how it can be done.

Note:  This may not 100% correct, as user threads are switching between CPU VPs from time to time. You may take as reference to capture repeated patterns.

Workaround:

(1) Get UNIX/Linux Top output:

$ top

CPU TTY  PID USERNAME PRI NI   SIZE    RES STATE    TIME %WCPU  %CPU COMMAND
7   ?  1858 informix 180 20  8880M  6924K sleep  745:47 51.95 51.86 oninit
4   ?  1854 informix 180 20  8880M  6940K sleep  937:14 50.19 50.10 oninit
6   ?  1856 informix 180 20  8880M  6924K sleep  792:30 49.22 49.13 oninit
3   ?  1811 informix 180 20  8880M  6956K run    991:33 47.55 47.46 oninit

(2) Map UNIX/Linux PID with CPU VP:

$ onstat -g glo | grep 1858 | grep cpu

vp    pid       class       usercpu   syscpu    total
5 1858      cpu         41120.30  3648.07   44768.37

(3) Get user owner thread from CPU VP number

$ onstat -g ath | grep 5cpu | grep running

tid     tcb              rstcb            prty status                vp-class      name
21804   c0000001ce72fd10 c00000019b7ead30 1    running                 5cpu        sqlexec

(4) Get session id from user thread

$ onstat -u | grep c00000019b7ead30

address          flags   sessid   user     tty      wait             tout locks nreads   nwrites
c00000019b7ead30 B–PR– 21188 cbbdb –        c00000001546f2e8 0    2     7984421  19732

(5) Show session contents with session id

$ onstat -g ses 21188

Tagged Under : , , , ,

Make a Comment