vineri, 20 noiembrie 2015

Kill all the blocking sessions (Real Application Cluster)

Give it a run as sysdba, from any instance:
begin
for obj in (
        SELECT s.inst_id,
               s.sid,
               s.serial#,
               p.spid,
               s.username,
               s.program
               FROM   gv$session s JOIN gv$process p 

                      ON p.addr = s.paddr 
                      AND p.inst_id = s.inst_id
               WHERE   blocking_session is not null 

                       and s.type != 'USER')
    loop
    execute immediate 'alter system kill session '''||obj.sid||','||obj.serial#||',@'||obj.inst_id||''''||' ';
end loop;
end;
/

Niciun comentariu:

Trimiteți un comentariu