Kill an Oracle Database Session
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';
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.