The syntax to kill a session in oracle database is :
ALTER SYSTEM KILL SESSION ‘SID,SERIAL#’ IMMEDIATE;
EXAMPLE:
First get the sid and serial# of the session;
Here the session is executing the query SELECT * FROM DBACLASS;
Use the below query to get the sid and serial# of this sql query.
COL SQL_TEXT format a45
SQL> SELECT a.sid,a.serial#,substr(b.sql_text,1,200) sql_text from v$sql b,
v$session a where a.sql_id=b.sql_id and upper(b.sql_text)
like '%DBACLASS%' and upper(b.sql_text) not like '%V$SQL%'; 2
SID SERIAL# SQL_TEXT
---------- ---------- ---------------------------------------------
24 19329 select * from dbaclass
----Now kill session :
SQL> alter system kill session '24,19329' immediate;
System altered.
