oracle查看死锁以及处理死锁

1. 查看死锁


select sess.sid, 
   sess.serial#, 
   lo.oracle_username, 
   lo.os_user_name, 
   ao.object_name, 
   lo.locked_mode 
   from v$locked_object lo, 
   dba_objects ao, 
   v$session sess 
where ao.object_id = lo.object_id and lo.session_id = sess.sid; 

2. 处理死锁

将上面查询出来的sid以及serial放入到下面的sql中进行替换就可以了

alter system kill session 'sid,serial';

示例:alter system kill session '4404,63693';

你可能感兴趣的:(oracle,数据库,sql)