Operating System - Tru64 Unix
1829403 Members
2013 Online
109991 Solutions
New Discussion

ip sockets for processes

 
Doug Wilburn
Advisor

ip sockets for processes

I have an oracle db server and everyone connects to it thru the application using the same db account. I'm trying to figure out a way to trace unix pid's back to the client machine. I can see the process id's with ps and I can see sockets/clients with netstat but can't figure out to relate the info.
2 REPLIES 2
Ivan Ferreira
Honored Contributor

Re: ip sockets for processes

This maybe can be done with lsof, attached is also another way using the kernel debugger.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Hein van den Heuvel
Honored Contributor

Re: ip sockets for processes

Just ask Oracle !? It is a trivial SQL query based on V$SESSION and V$PROCESS
Here is an example I use:

-------------- process.sql ---------------
column id format 999;
column Local format 99999;
column Remote format 99999;

column Node format a9;
column Local_Program format a20;
column Remote_Program format a24;
set pages 9999;

select pid "Id", spid "Local", process "Remote",
s.machine "Node", SUBSTR(p.program,1,20) "Local Program",
SUBSTR(s.program,1,24) "Remote Program"
from v$process p, v$session s
where addr = paddr
order by machine, spid
/



Hth,
Hein van den Heuvel
HvdH Performance Consulting