Skip to content

Instantly share code, notes, and snippets.

@davidhooey
Created September 24, 2014 15:42
Show Gist options
  • Save davidhooey/4f7c96393f5cdbcae427 to your computer and use it in GitHub Desktop.
Save davidhooey/4f7c96393f5cdbcae427 to your computer and use it in GitHub Desktop.
Oracle Which SQL_ID Caused A Particular Wait Event
select
event,
sql_id,
snap_id,
dbid,
instance_number,
sample_time,
session_id,
session_serial#,
user_id,
blocking_session,
program,
(
select
sql_text
from
dba_hist_sqltext
where
sql_id = dba_hist_active_sess_history.sql_id
) sql_text
from
dba_hist_active_sess_history
where
program = 'some.exe'
and
sample_time between
to_timestamp('START_TIME', 'YYYY-MM-DD HH24:MI:SS.FF3') and
to_timestamp('END_TIME', 'YYYY-MM-DD HH24:MI:SS.FF3')
and
event = 'some wait event'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment