Techie Tip – I need to find out what DB2 LUW V9.5 processes are running on a Linux machine
Question:
I need to find out what DB2 LUW V9.5 processes are running on a Linux machine? Is there another way other than ‘ps –ef’ or ‘ps aux’ than grepping out the result set?
Answer:
There is. A script by the name db2_local_ps that does the work for you. It saves time because one does not have to fumble around figuring out the command syntax to perform the actions to achieve similar results.
Actually, there are three scripts that are linked together to do the work.
‘db2_local_ps’ is the initial script that is called. This script checks for the DB2INSTANCE environment variable. If it is set and valid, you progress. If not, it exits and a usage message is displayed.
The other scripts that are in the chain that are called in order are ‘db2nps’ and ‘db2gdep’, both shell scripts. ‘db2nps’ obtains the process name and number and calls the script ‘db2gdep’ for each process for the information on that specific process.
The output from the ‘db2_local_ps’ follows:
cvross@myhost:~> db2_local_ps
Node 0
UID PID PPID C STIME TTY TIME CMD
db2inst1 20979 20978 0 08:21 pts/1 00:00:00 db2sysc 0
root 20980 20979 0 08:21 pts/1 00:00:00 db2ckpwd 0
root 20981 20979 0 08:21 pts/1 00:00:00 db2ckpwd 0
root 20982 20979 0 08:21 pts/1 00:00:00 db2ckpwd 0
root 20983 20979 0 08:21 pts/1 00:00:00 db2pmd 0
db2inst1 20984 20979 0 08:21 pts/1 00:00:00 db2gds 0
db2inst1 20985 20979 0 08:21 pts/1 00:00:00 db2licc 0
db2inst1 20986 20979 0 08:21 pts/1 00:00:00 db2ipccm 0
db2inst1 20987 20979 0 08:21 pts/1 00:00:00 db2tcpcm 0
db2inst1 20988 20979 0 08:21 pts/1 00:00:00 db2tcpcm 0
db2inst1 20992 20979 0 08:21 pts/1 00:00:00 db2resync 0
db2inst1 20994 20979 0 08:21 pts/1 00:00:00 db2acd 0 ,0,0,0,1,0,0,0,897e0c,14,1e014,2,0,1,11fd0,0×11f90000,0×11f90000,1610000,8b001e,2,530011
db2inst1 21201 20984 0 08:23 pts/1 00:00:00 db2logts (SAMPLEA) 0
db2inst1 21202 20984 0 08:23 pts/1 00:00:00 db2logmgr (SAMPLEA) 0
db2inst1 21203 20984 0 08:23 pts/1 00:00:00 db2loggr (SAMPLEA) 0
db2inst1 21207 20984 0 08:23 pts/1 00:00:00 db2loggw (SAMPLEA) 0
db2inst1 21208 20984 0 08:23 pts/1 00:00:00 db2lfr (SAMPLEA) 0
db2inst1 21209 20984 0 08:23 pts/1 00:00:00 db2dlock (SAMPLEA) 0
db2inst1 21210 20984 0 08:23 pts/1 00:00:00 db2pclnr 0
db2inst1 21211 20984 0 08:23 pts/1 00:00:00 db2pfchr 0
db2inst1 21212 20984 0 08:23 pts/1 00:00:00 db2pfchr 0
db2inst1 21213 20984 0 08:23 pts/1 00:00:00 db2pfchr 0
db2inst1 21214 20984 0 08:23 pts/1 00:00:00 db2stmm (SAMPLEA) 0
db2inst1 21215 20984 0 08:23 pts/1 00:00:00 db2taskd (SAMPLEA) 0
db2inst1 21216 20984 0 08:23 pts/1 00:00:00 db2evmgi (DB2DETAILDEADLOCK) 0
db2inst1 21200 20986 0 08:23 pts/1 00:00:00 db2agent (SAMPLEA) 0
db2inst1 21471 20986 0 08:26 pts/1 00:00:00 db2agent (idle) 0
db2inst1 21472 20986 0 08:26 pts/1 00:00:00 db2agent (idle) 0
This is definitely something worthy to know about. One could alias the command with a name that is more useful for a specific computing environment. Or, just look at the code and roll your own version.
The only caveat with this command is that the db2profile needs to be sourced or the DB2 environment variables need to be loaded in your user profile.
Happy Trails.




