查询锁表1
select /*+ rule */ distinct
o.owner, o.object_name, s.sid, s.status, s.process, s.machine, s.program, 'kill -9 ' || p.spid command, l.type,
l.lmode, l.request, l.ctime
from dba_objects o, gv$lock l, gv$session s, gv$process p
where o.object_id = l.id1 and l.type = 'TM' and s.sid = l.sid
and p.addr = s.paddr
查询锁表2(在数据库中执行SQL处理)
SELECT OBJECT_NAME,SESSION_ID SID,MACHINE,VS.MODULE, 'ALTER SYSTEM KILL SESSION '''||SESSION_ID|| ', '||SERIAL#|| '''; ' 解锁语句 ,VS.STATUS,VS.ACTION,SERIAL#,ORACLE_USERNAME,OS_USER_NAME
FROM V$LOCKED_OBJECT VO, V$SESSION VS, ALL_OBJECTS AO
WHERE VO.SESSION_ID = VS.SID AND AO.OBJECT_ID = VO.OBJECT_ID AND NVL(VS.ACTION, ' ') <> 'Service Management ' ORDER BY OBJECT_NAME,MACHINE,VS.MODULE;
确定有锁表后,登录锁表的数据库,kill对应进程。
标签:SESSION,gv,锁表,OBJECT,表处理,VS,oracle,ID From: https://www.cnblogs.com/teiperfly/p/18138769