Oracle杀死死锁进程
先查看哪些表被锁住了:
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; OWNER OBJECT_NAME SESSION_ID LOCKED_MODE ------------------------------ ----------------- WSSB SBDA_PSHPFTDT 22 3 WSSB_RTREPOS WB_RT_SERVICE_QUEUE_TAB 24 2 WSSB_RTREPOS WB_RT_NOTIFY_QUEUE_TAB 29 2 WSSB_RTREPOS WB_RT_NOTIFY_QUEUE_TAB 39 2 WSSB SBDA_PSDBDT 47 3 WSSB_RTREPOS WB_RT_AUDIT_DETAIL 47 3 select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time; USERNAME SID SERIAL# LOGON_TIME ------------------------------ ---------- ------- WSSB_RTACCESS 39 1178 2006-5-22 1 WSSB_RTACCESS 29 5497 2006-5-22 1
杀进程中的会话:
alter system kill session 'sid,serial#'; e.g alter system kill session '29,5497';
如果有ora-00031错误,则在后面加immediate;alter system kill session '29,5497' immediate;