Tuesday, May 18, 2010

Active Session's recursive call%

column event format a30
column program format a30
column status format a10
column sql_id format a15
set linesize 200
set pagesize 200

select /*+ ordered */ a.sid,event,p1,p2,p3,program,sql_id,status , b.value "user_calls",
       c.value "recursive_calls", d.value "execution",
       round(c.value/(c.value+b.value) * 100,1) "recursive_call%"
from v$session a, v$sesstat b, v$sesstat c, v$sesstat d
where a.sid = b.sid
and b.sid = c.sid
and c.sid = d.sid
and b.STATISTIC# = 6
and c.STATISTIC# = 7
and d.STATISTIC# = 451
and wait_class not in ('Idle')
/