ora_proxy_connections_info.sql

set lines 400
set pages 500
col username for a20
col authentication_type  for a19
col status for a8
col machine||PORT||osuser||program for a78
col "module || event" for a70
select s.username,
       gsci.authentication_type,
       s.inst_id,
       s.sid,
       s.serial#,
       s.status,
       to_char(s.logon_time, 'yyyy-mm-dd hh24:mi:ss') "LOGON_TIME",
       to_char(TRUNC(s.last_call_et/86400), 'fm99900') || 'd' ||
       to_char(trunc((s.last_call_et-86400*(trunc(s.last_call_et/86400)))/3600), 'fm00') || 'h' ||
       to_char(trunc((s.last_call_et-3600*trunc(s.last_call_et/3600))/60), 'fm00') || 'm' ||
       to_char((s.last_call_et-60*trunc(s.last_call_et/60)), 'fm00') || 's' "ELAPSED_TIME"
      ,s.machine || '||' || s.port || '||' || s.osuser || '||' || s.program "MACHINE||PORT||OSUSER||PROGRAM"      
      ,s.module || ' || ' || s.event "MODULE || EVENT"
      ,s.process
      ,p.spid
      ,s.sql_id
      ,s.prev_sql_id
      ,s.con_id
from gv$session s, 
     gv$process p,
     (select distinct inst_id,
              sid,
              serial#,
              authentication_type 
       from gv$session_connect_info) gsci
where s.status in ('ACTIVE', 'INACTIVE')
  and s.type <> 'BACKGROUND'
  and s.paddr = p.addr
  and s.inst_id = p.inst_id
  and s.inst_id = gsci.inst_id 
  and s.sid = gsci.sid
  and s.serial# = gsci.serial#
  and gsci.authentication_type = 'PROXY';
Rolar para cima