← Sessions & Locks
Oracle · Sessions & Locks
How to kill a session in Oracle
Kill a specific Oracle session with ALTER SYSTEM KILL SESSION IMMEDIATE and verify it is gone.
Tested on11g12c18c19c21c23ai26ai
ALTER SYSTEM KILL SESSION marks a session for termination. IMMEDIATE tells PMON to clean it up right away and roll back any open transaction.
This ends the session and rolls back its uncommitted work. Get SID and SERIAL# from V$SESSION first and confirm you are killing the right one — a SID is reused for later sessions.
-- Find the session first
SELECT sid, serial#, username, machine, program, status, last_call_et, sql_id
FROM v$session
WHERE username = UPPER('&&target_user')
ORDER BY last_call_et;
-- Kill it (SID and SERIAL# from the query above)
ALTER SYSTEM KILL SESSION '&&sid,&&serial' IMMEDIATE;
-- Verify (read-only) — the row should be gone, or STATUS should be KILLED
SELECT sid, serial#, username, status, last_call_et
FROM v$session
WHERE sid = &sid AND serial# = &serial;sessionskillalter system