declare
cursor mycur is
select s.sid, s.serial#
from v$session s, v$lock l, dba_objects o
where l.sid = s.sid
and l.id1 = o.object_id(+)
and o.object_name = 'table_name';
newcount number;
begin
for cur in mycur loop
select count(1)
into newcount
from v$locked_object a, v$session b
where a.session_id = b.sid
and b.sid = cur.sid
and b.serial# = cur.serial#;
if newcount >= 1 then
execute immediate ('alter system kill session ''' || cur.sid || ',' ||
cur.serial# || ''' ');
end if;
end loop;
end;
Oracle批量杀死锁.sql
猜你喜欢
转载自vernonchen163.iteye.com/blog/2025009
今日推荐
周排行