--查出oracle當(dāng)前的被鎖對(duì)象
SELECT l.session_id sid,?
? ? ? s.serial#,?
? ? ? l.locked_mode 鎖模式,?
? ? ? l.oracle_username 登錄用戶,?
? ? ? l.os_user_name 登錄機(jī)器用戶名,?
? ? ? s.machine 機(jī)器名,?
? ? ? s.terminal 終端用戶名,?
? ? ? o.object_name 被鎖對(duì)象名,?
? ? ? s.logon_time 登錄數(shù)據(jù)庫(kù)時(shí)間?
FROM v$locked_object l, all_objects o, v$session s?
WHERE l.object_id = o.object_id?
? AND l.session_id = s.sid?
ORDER BY sid, s.serial#;?
--殺掉進(jìn)程 sid,serial#
alter system kill session '223,10747';
--批量殺死進(jìn)程
declare cursor mycur is?
select b.sid,b.serial#?
from v$locked_object a,v$session b?
where a.session_id = b.sid group by b.sid,b.serial#;?
begin?
? for cur in mycur?
? ? loop? ?
? ? execute immediate ( 'alter system? kill session? '''||cur.sid || ','|| cur.SERIAL# ||''' ');?
? ? end loop;?
end;