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%' ;
标签:--,阻塞,查询,session,inst,SID,ORACLE,id,select 来源: https://www.cnblogs.com/chriskwok/p/16067884.html