Thursday, April 4, 2013

Show Database Sessions related to an Application Module


SELECT s.audsid AUDSID,
       i.instance_name "Instance",
       s.machine "Machine",
       s.program "Program",
       s.module "Module",
       s.username "Username",
       s.osuser "User",
       s.process "Process",
       s.status "Status",
       s.logon_time "Logon Time"
  FROM gv$session s, gv$instance i
 WHERE     s.audsid > 0
       AND s.inst_id = i.inst_id
       AND s.module LIKE '%' || &1 || '%'
       AND s.module NOT LIKE '%:R'
       AND s.process LIKE '%' || &2 || '%';