一分钟解决Oracle死锁

 
--第一步:查看是否有死锁存在,查出有数据则代表有死锁    
select p.spid,c.object_name,b.session_id,b.oracle_username,b.os_user_name  from v$process p,v$session a,v$locked_object b,all_objects   c   
where  p.addr=a.paddr   
and    a.process=b.process   
and    c.object_id=b.object_id 


--第二步:查出死锁session的精确信息【sid 为前面语句的session_id】  
SELECT sid, serial#, username, osuser FROM v$session where sid='第一步查询出来的session_id'; 


--第三步:删除死锁【第一个参数为sid,第二个为serial#】  
alter system kill session '第一个参数,第二个参数'; 

猜你喜欢

转载自wuhuajun.iteye.com/blog/1880886