Running procedures?

You can use what is below to print out each session that is currently executing (or has pinned) a given stored procedure

column owner format a20
column name format a30
column type format a15
set lines 255 trims on
SELECT substr(DECODE(o.kglobtyp,7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE', 12, 'TRIGGER', 13,'CLASS'),1,15)  "TYPE",
       substr(o.kglnaown,1,30)  "OWNER",
       substr(o.kglnaobj,1,30)  "NAME",
       s.indx  "SID",
       s.ksuseser  "SERIAL"
  FROM sys.X$KGLOB  o,
       sys.X$KGLPN  p,
       sys.X$KSUSE  s
  WHERE o.inst_id = USERENV('Instance')
    AND p.inst_id = USERENV('Instance')
    AND s.inst_id = USERENV('Instance')
    AND o.kglhdpmd = 2
    AND o.kglobtyp IN (7, 8, 9, 12, 13)
    AND p.kglpnhdl = o.kglhdadr
    AND s.addr = p.kglpnses
  ORDER BY 1, 2, 3;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.