Skip to content

Commit

Permalink
new script
Browse files Browse the repository at this point in the history
  • Loading branch information
jkstill committed Sep 18, 2024
1 parent 8e72645 commit b2c3e66
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions INDEX
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ EVENTS:
@sysevent_begin.sql: Beginning snapshot of system events
@sysevent_end.sql: Ending snapshot of system events
@sysevent_rpt.sql: Report on system event snapshots
@sysevent-top-10.sql: Report top 10 events from v$sysevent
@sessevent2.sql: Show events from v$session_event
@sessevent.sql: Show events from v$session_event
@session_fix.sql: Show fix_control_settings for session
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
<a href='https://github.com/jkstill/oracle-script-lib/blob/master/sql/sysevent_begin.sql'>sysevent_begin.sql</a> - Beginning snapshot of system events
<a href='https://github.com/jkstill/oracle-script-lib/blob/master/sql/sysevent_end.sql'>sysevent_end.sql</a> - Ending snapshot of system events
<a href='https://github.com/jkstill/oracle-script-lib/blob/master/sql/sysevent_rpt.sql'>sysevent_rpt.sql</a> - Report on system event snapshots
<a href='https://github.com/jkstill/oracle-script-lib/blob/master/sql/sysevent-top-10.sql'>sysevent-top-10.sql</a> - Report top 10 events from v$sysevent
<a href='https://github.com/jkstill/oracle-script-lib/blob/master/sql/sessevent2.sql'>sessevent2.sql</a> - Show events from v$session_event
<a href='https://github.com/jkstill/oracle-script-lib/blob/master/sql/sessevent.sql'>sessevent.sql</a> - Show events from v$session_event
<a href='https://github.com/jkstill/oracle-script-lib/blob/master/sql/session_fix.sql'>session_fix.sql</a> - Show fix_control_settings for session
Expand Down
39 changes: 39 additions & 0 deletions sql/sysevent-top-10.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

-- sysevent-top-10.sql
-- Show the top 10 foreground wait events in the database
-- Jared Still - 2024-09-18


set linesize 200 trimspool on

col name format a40
col total_waits_fg format 999,999,999
col time_waited_micro_fg format 9,999,999,999,999.099999
col time_waited format 99,999,999.099999
col average_wait_fg format 99,999,999.099999

with data as (
select
n.name
, e.total_waits_fg
, e.time_waited_micro_fg
, e.average_wait_fg
from v$system_event e
join v$event_name n
on n.event_id = e.event_id
and n.wait_class = 'Other'
and e.total_waits_fg > 1
order by e.time_waited
)
select
e.name
, e.total_waits_fg
, e.time_waited_micro_fg
, e.time_waited_micro_fg / e.total_waits_fg time_waited , e.average_wait_fg
--, e.average_wait_fg / 100 average_wait_cs
from data e
order by e.time_waited_micro_fg
fetch first 10 rows only
/


0 comments on commit b2c3e66

Please sign in to comment.