Skip to content

Instantly share code, notes, and snippets.

@glandaverde
Created November 10, 2015 17:10
Show Gist options
  • Select an option

  • Save glandaverde/65c927566099d72e5a09 to your computer and use it in GitHub Desktop.

Select an option

Save glandaverde/65c927566099d72e5a09 to your computer and use it in GitHub Desktop.
sql_id_time_waited_awr
SELECT
INSTANCE_NUMBER,event,
time_waited "time_waited(s)",
case when time_waited = 0 then
0
else
round(time_waited*100 / sum(time_waited) Over(), 2)
end "percentage"
from
(
SELECT INSTANCE_NUMBER,EVENT, SUM(TIME_WAITED) TIME_WAITED
from dba_hist_active_sess_history a
WHERE SQL_ID = ''
AND DBID=''
and snap_id BETWEEN and
group by INSTANCE_NUMBER,event
)
order by
time_waited desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment