Find the blocking session
OracleSessions & ProcessesCommand
SELECT bl.sid AS blocker_sid,
bl.serial# AS blocker_serial,
bl.username AS blocker_user,
w.sid AS waiter_sid,
w.serial# AS waiter_serial,
w.username AS waiter_user,
w.seconds_in_wait AS wait_sec,
w.event
FROM v$session w
JOIN v$session bl ON bl.sid = w.blocking_session
WHERE w.blocking_session IS NOT NULL
ORDER BY w.seconds_in_wait DESC;What it does
Lists blocker and waiter session pairs with the wait time and event.
When to use it
To find the culprit in lock problems such as "application hung / enq: TX wait".
Caution
Confirm with the business owner before killing the blocker; it may be a critical operation. Query only; no risk.