1. Home
  2. Knowledge Base
  3. Database Administration
  4. Using DBMS_SCHEDULER to run a UNIX shell script
  1. Home
  2. Knowledge Base
  3. Scripts
  4. Using DBMS_SCHEDULER to run a UNIX shell script

Using DBMS_SCHEDULER to run a UNIX shell script

CREATE A PROGRAM

begin

dbms_scheduler.create_program

(

program_name => ‘UPDATE_VERITAS’,

program_type => ‘EXECUTABLE’,

program_action => ‘/opt/oracle/scripts/blade08/update_veritas.sh’,

enabled => TRUE,

comments => ‘Check the Time’

);

end;

/

 CREATE A SCHEDULE
 

begin

dbms_scheduler.create_schedule

(

schedule_name => ‘EVERY_6_HOURS’,

repeat_interval => ‘FREQ=HOURLY; INTERVAL=6?,

comments => ‘Every 6 Hours’

);

end;

/

 
CREATE A JOB
 

begin

dbms_scheduler.create_job

(

job_name => ‘RUN_UPDATE_VERITAS’,

program_name => ‘UPDATE_VERITAS’,

schedule_name => ‘EVERY_6_HOURS’,

comments => ‘Run the program UPDATE_VERITAS every 6 Hours’,

enabled => TRUE

);

end;

/

 

RUN THE JOB MANUALLY

exec dbms_scheduler.run_job(’RUN_UPDATE_VERITAS’);

 
Check the job run status and other details      
 

select log_id, log_date, job_name, status, error#, additional_info
 from dba_scheduler_job_run_details
where job_name =’RUN_UPDATE_VERITAS’;

The following two tabs change content below.

Gavin Soorma

Latest posts by Gavin Soorma (see all)

Updated on June 2, 2021

Was this article helpful?

Related Articles

Comments

  1. Hi could you pls put the contents of the
    script – ‘/opt/oracle/scripts/blade08/update_veritas.sh’

Leave a Comment