SQL QUERY TO FIND SESSION DETAILS FROM ACTIVE SESSION HISTORY(ASH)

SQL QUERY TO FIND SESSION DETAILS FROM ACTIVE SESSION HISTORY(ASH)

Use this ash query to find the session details in near past which has details about SQL and wait events

set lines 200
set pages 1000
col event format a10
col sample_time format a20
col session_id format 99999999
col session_state format a20
col wait_time format 9999999
col time_waited format 99999999
col child# format 999
select session_id,
sample_time,
session_state,
event,
wait_time,
time_waited,
sql_id,
sql_child_number child#
from v$active_session_history
where sample_time > sysdate - 3
order by sample_time asc;
fetch next 10 rows only;

Leave a Reply

%d bloggers like this: