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
(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