如何彻底杀死Oracle会话

当你觉得一个长时间运行的一个PL/SQL,有问题时需要立即中止,怎么办:有两种方法:
1.执行
alter system kill session 'sid,serial#'
    这里的sid,serial# 可以在V$Session中找到。执行这个命令,有时候不一定有效。而且看起来杀掉了,
    但是使用的相关资源,也不一定被释放了。那么这时候就要用到下面这种方法了:
2.操作系统级的命令OraKill
   这个命令是Oracle自带的命令,在Oracle_Home的bin目录下。
   执行不带任何参数的OraKill, 会给出下面的提示:
    
Usage:  orakill sid thread
     where sid    = the Oracle instance ID to target
        thread = the thread id of the thread to kill
      The thread id should be retrieved from the spid column of a query such as:

        select spid, osuser, s.program from
        v$process p, v$session s where p.addr=s.paddr


     这个命令瞬间会把相关的进程杀掉,所以使用的时候一定要小心。
     相关的文章,请参见http://www.eygle.com/faq/Kill_Session.htm





原文地址:https://www.cnblogs.com/SharkXu/p/OraleKillSession.html