← Sessions & Locks
Oracle · Sessions & Locks
How to check top wait events for a session in Oracle
Rank cumulative wait events for a given Oracle session from V$SESSION_EVENT to see where its time went.
Tested on11g12c18c19c21c23ai26ai
V$SESSION_EVENT aggregates every wait the session has done since it connected. Ranking by TIME_WAITED tells you where its time actually went — CPU, I/O, locks, or network.
ACCEPT p_sid NUMBER PROMPT 'Enter SID: '
SELECT sid, event, total_waits, total_timeouts,
ROUND(time_waited / 100, 2) AS time_waited_sec,
ROUND(average_wait / 100, 2) AS avg_wait_sec,
wait_class
FROM v$session_event
WHERE sid = &&p_sid
ORDER BY time_waited DESC;sessionswaitsv$session_event