Killing Oracle Sessions

If you are logged into the system with enough rights (e.g. SYSADM) you can kill database sessions that are not ACTIVE. To do so, first identify the appropriate session ID (sid) and serial number using this query:

SELECT s.sid,
       s.serial#,
       s.osuser,
       s.program,
       s.machine,       
       s.status,
       s.state
FROM   v$session s
WHERE  OSUSER = ':UserID'
AND    STATUS <> 'ACTIVE';

See this guide for more information.

Replace User ID with your OS username.

To kill the session use the following command:

alter session kill session 'sid,serial#' immediate;

Note that the IMMEDIATE keyword is only if you want the session to be killed instantly. That is you know it should be killed. You will need to enter the sid and the serial number to kill the session correctly.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License