1 --首先查看有哪些锁 2 select /*+ rule */ s.username, 3 decode(l.type,‘TM‘,‘TABLE LOCK‘,‘TX‘,‘ROW LOCK‘,null) lock_level, 4 o.owner, 5 o.object_name, 6 o.object_type, 7 s.sid,s.serial#, 8 s.terminal, 9 s.machine, 10 s.program, 11 s.osuser 12 from v$session s,v$lock l,dba_objects o 13 where l.sid = s.sid 14 and l.id1 = o.object_id(+) 15 and s.username is not null 16 17 --如果发生了锁等待,看是谁锁了表而引起谁的等待 18 --以下的语句可以查询到谁锁了表,而谁在等待。 如果有子节点,则表示有等待发生 19 select /*+ rule */ lpad(‘ ‘,decode(l.xidusn ,0,3,0))||l.oracle_username user_name, 20 o.owner, 21 o.object_name, 22 o.object_type, 23 s.sid, 24 s.serial# 25 from v$locked_object l,dba_objects o,v$session s 26 where l.object_id=o.object_id 27 and l.session_id=s.sid 28 order by o.object_id,xidusn desc 29 30 31 --找到引起等待的session,杀掉该session: 32 alter system kill session ‘sid,serial#‘;
http://bbs.csdn.net/topics/370025735
时间: 2024-10-13 11:57:30