ORACLE-查询最终阻塞者进程脚本

2022/3/28 19:22:43

本文主要是介绍ORACLE-查询最终阻塞者进程脚本,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1、查询最终阻塞者进程:

select 'alter system kill session '''|| sid ||',' || serial# || ',@'|| inst_id ||''' immediate;',
   sys_connect_by_path(a.SID || '@' || a.inst_id, ' <- ') tree, --  tree最后一个为最终阻塞者.
   a.inst_id,   a.process,   a.sid,   a.serial#,   a.sql_id,   a.event,   a.status,   a.program,
   a.machine,   connect_by_isleaf as isleaf,   level as tree_level
from gv$session a
 start with a.blocking_session is not null
 connect by (a.sid || '@' || a.inst_id) = prior
       (a.blocking_session || '@' || a.blocking_instance);

2、ORA-14450:试图访问已经在使用的事务处理临时表:

-- ORA-14450: 试图访问已经在使用的事务处理临时表
select 'alter system kill session ''' || a.SID || ',' || a.SERIAL# || ',@' || inst_id || ''' immediate;' ,a.* from gV$session a
    where a.SID in (select sid from gv$enqueue_lock t where t.type='TO')
    --and status='INACTIVE'
    --and a.program like '%JDBC Thin Client%'
    ; 

 



这篇关于ORACLE-查询最终阻塞者进程脚本的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程