How to find the database session for JVM PID

Last updated on July 29th, 2016 at 06:26 am

To find total number of open database connections for a given JVM PIDSELECT s.process, Count(*) all_count FROM   gv$session s WHERE s.process IN () GROUP BY  s.process

To find number of database connections per JVM that were inactive for longer then 60 minutes

SELECT s.process, Count(*) olderConnection_count FROM   gv$session s WHERE  s.process IN ()
and  s.last_call_et>=(60*60) and s.status=’INACTIVE’ GROUP BY  s.process

To find the modules responsible to JDBC connections for a process id

SELECT Count(*), process,machine, program, MODULE FROM v$session s
WHERE s.process IN (‘&id’)GROUP BY process,machine, program, MODULE ORDER BY process,machine, program, MODULE;

column module heading “Module Name” format a48;
column machine heading “Machine Name” format a15;
column process heading “Process ID” format a10;
column inst_id heading “Instance ID” format 99;
prompt Connection Usage Per Module and process
select to_char(sysdate, ‘dd-mon-yyyy hh24:mi’) Time from dual
prompt ~~~~
select count(*), machine, process, module from v$session
where program like ‘JDBC%’ group by machine, process, module order by 1 asc

Leave a Reply