Killing an Oracle Session Windows

Find sid, serial#, spid of user sessions

col osuser for a50
col program for a40
set lines 200
SELECT s.sid, s.serial#, s.con_id, p.SPID, s.OSUSER, s.PROGRAM
FROM V$PROCESS p JOIN V$SESSION s
ON p.ADDR= s.PADDR
WHERE s.USERNAME IS NOT NULL;

On windows we have 2 ways to kill a session from backend
a) ORAKILL from o/s this returns prompt while kill still occurs in background
syntax: ORAKILL <ORACLE_SID name> <SPID>

example: ORAKILL ORCL 1324

wait 2 minutes and see if session is gone.

b) ALTER SESSION from db this command is immediate

For CDB/PDB the kill can be run from the container DB CDB$ROOT


syntax: ALTER SYSTEM DISCONNECT SESSION ‘<sid>,<serial#>’ IMMEDIATE;

example ALTER SYSTEM DISCONNECT SESSION ‘231,23423’ IMMEDIATE;