Logo Background

How To Kill Oracle DB Session

  • By on August 19, 2008 | No Comments

    If you have a bad Oracle database process running, the right way to stop it will be using the SQL line instead of kill command from UNIX level: –

    Kill Oracle Database Session

    SQL> ALTER system KILL SESSION 'sid, serial#'

    To execute this command, you need sid and serial#, where it can be found using the SQL line as below: –

    SQL> SELECT b.sid, b.serial#, a.spid, b.program, b.osuser, b.machine, 
    b.type, b.event, b.action, b.p1text, b.p2text, b.p3text, b.state, c.sql_text,b.logon_time
    FROM v$process a, v$session b, v$sqltext c
    WHERE a.addr=b.paddr
    AND b.sql_hash_value = c.hash_value
    AND b.status = 'ACTIVE'
    ORDER BY a.spid, c.piece

    You may run the command either in SQL PLUS or TOAD

    Previous
    Next
    » Oracle Bad SQL Detection Script
Leave a Comment