Kill Sessions Running a Program

by Granville Bonyata on April 22, 2017

Handy script to kill all sessions that are running a particular package:

select distinct ' ALTER SYSTEM KILL SESSION '||''''||sid||','||serial#|| ',@' || inst_id ||'''' ||'  IMMEDIATE;'
  from gv$session s
 where EXISTS (
               select 'x'
                 from gv$access a
                where object = 'package name'
                  and a.inst_id = s.inst_id
                  and a.sid = s.sid

Previous post:

Next post: