日期:2014-05-16  浏览次数:20543 次

oracle 处理死锁
需以dba角色登录

--查询死锁的sql
select sql_text from v$sql where hash_value in 
(select sql_hash_value from v$session where sid in
(select session_id from v$locked_object));

--查询死锁的session
--sid是session唯一标识,serial#是每条执行命令的标识
select sid,serial# from v$session where sid in
(select session_id from v$locked_object);

--kill dead lock session
--sid,serial#是上面查询到的具体值
alter system kill session 'sid,serial#';
commit;


v$session介绍
http://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2088.htm