死锁及解决办法

第一步:查询存在的死锁标识:
1. select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b
where b.object_id = a.object_id
2. select t2.username||' '||t2.sid||' '||t2.serial#||' '||t2.logon_time||' '||t3.sql_text
from v$locked_object t1,v$session t2,v$sqltext t3
where t1.session_id=t2.sid and t2.sql_address=t3.address order by t2.logon_time;
3. SELECT s.username,l.OBJECT_ID,l.SESSION_ID,s.SERIAL#,l.ORACLE_USERNAME,l.OS_USER_NAME,l.PROCESS
FROM V$LOCKED_OBJECT l,V$SESSION S WHERE l.SESSION_ID=S.SID;
第二步,杀掉会话:
alter system kill session 'sid,serial#'; 举例: alter system kill session '122,487';

posted @ 2020-05-23 09:45  water.wjf  阅读(118)  评论(0编辑  收藏  举报