清除 oracle的表锁定

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34359363/article/details/79963830

先看看有哪些锁定

 select /*+ rule */ s.username,
      decode(l.type,'TM','TABLE LOCK','TX','ROW LOCK',null) lock_level,
      o.owner,
      o.object_name,
      o.object_type,
      s.sid,s.serial#,
      s.terminal,
      s.machine,
      s.program,
      s.osuser
from v$session s,v$lock l,dba_objects o
where l.sid = s.sid
and l.id1 = o.object_id(+)
and s.username is not null

在看锁定的sid

select /*+ rule */ lpad(' ',decode(l.xidusn ,0,3,0))||l.oracle_username user_name,
       o.owner,
       o.object_name,
       o.object_type,
       s.sid,
       s.serial#
from v$locked_object l,dba_objects o,v$session s
where l.object_id=o.object_id
and l.session_id=s.sid
order by o.object_id,xidusn desc;

最后删除锁定

alter system kill session '968,10069'; sid 和serial


阅读更多

没有更多推荐了,返回首页