Toad auto refresh execution feature

is there any feature similar to pl/sql developer to execute statement every n second ?

i want to kill oracle sessions that have certain sql_id every 5 second .

thanks in advance :smiley:

Toad doesn't have a way to execute a SQL every N seconds, but I think a better way to do what you want to achieve would be to create a scheduler job to do that, so Toad doesn't need to be running at the time.

CREATE OR REPLACE PROCEDURE cancel_sql_id
IS
BEGIN
   FOR f IN (SELECT   sid, serial#
               FROM   v$session
              WHERE   sql_id IN ('12btcvkncddfz', '0f6r1wy8atwmt'))
   LOOP
      EXECUTE IMMEDIATE   'alter system disconnect session '''
                       || f.sid
                       || ','
                       || f.serial#
                       || ''' immediate';

   END LOOP;
END;
/

BEGIN
   DBMS_SCHEDULER.create_job (
      job_name          => 'job_cancel_sql_id',
      job_type          => 'STORED_PROCEDURE',
      job_action        => 'cancel_sql_id',
      start_date        => SYSTIMESTAMP,
      repeat_interval   => 'FREQ=MINUTELY;INTERVAL=5',
      end_date          => NULL,
      enabled           => TRUE,
      comments          => 'cancel sql ids'
   );
END;
/
1 Like