The following statement indicates the sessions that have caused the most load as a percentage of all foreground sessions;
select ah.session_id
,ah.session_type
,nvl(ah.sql_id,'xx') as SQL_ID
,count(*) as Session_Cnt
,round(count(*)/sum(count(*)) over(), 2) as Percent_Load
from
v$active_session_history ah
where
ah.sample_time >to_date('31-OCT-11 11:40','dd-MON-yy hh24:mi')
and ah.session_type='FOREGROUND'
group by
ah.session_id
,ah.session_type
,ah.sql_id
order by count(*) desc
,ah.session_type
,nvl(ah.sql_id,'xx') as SQL_ID
,count(*) as Session_Cnt
,round(count(*)/sum(count(*)) over(), 2) as Percent_Load
from
v$active_session_history ah
where
ah.sample_time >to_date('31-OCT-11 11:40','dd-MON-yy hh24:mi')
and ah.session_type='FOREGROUND'
group by
ah.session_id
,ah.session_type
,ah.sql_id
order by count(*) desc
/
No comments:
Post a Comment