Oracle之锁表问题

查找用户锁

View Code
select   s.username, 
decode(l.type, 'TM ', 'TABLE LOCK ',
'TX ', 'ROW LOCK ',
NULL) LOCK_LEVEL,
o.owner,o.object_name,o.object_type,s.terminal,s.machine,s.program,s.osuser
from v$session s,v$lock l,dba_objects o
where s.sid=l.sid
and o.object_id=l.id1
and s.username is not null

 

查找锁等待

View Code
select   lpad( '',decode(l.xidusn,0,3,0))||l.oracle_username   User_name, 
o.owner,o.object_name,o.object_type
from v$locked_object l,dba_objects o
where l.object_id=o.object_id
order by o.object_id desc

 

找出相应的

View Code
alter   system   kill   session   'sid,   serial# '   
or
alter system disconnect session 'sid, serial# ' immediate;

 

posted on 2012-03-15 16:10  Ronger  阅读(807)  评论(0编辑  收藏  举报