Friday, August 8, 2008

Kill Session

To Find out SID and SERIAL#:

SELECT VA.SQL_TEXT,VS.SID, VS.SERIAL#,process,vs.status, vp.pid
FROM V$SQLAREA VA, V$SESSION VS, v$process vp
WHERE VA.ADDRESS = VS.SQL_ADDRESS
AND VA.HASH_VALUE = VS.SQL_HASH_VALUE
AND VS.PADDR = VP.ADDR
AND upper(sql_text) LIKE '%SEARCHING_TEXT%';

-- to kill the session

ALTER SYSTEM KILL SESSION 'sid,serial#'