Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Tuesday, 15 May 2012

Using DBMS_SCHEDULER to run a UNIX shell script

CREATE A PROGRAM
begin
dbms_scheduler.create_program
(
program_name => 'RMAN_BACKUP',
program_type => 'EXECUTABLE',
program_action => '/oracle/scripts/RMAN_BACKUP.sh',
enabled => TRUE,
comments => 'WEEKLY RMAN BACKUP ON FRIDAY MORING 4 AM'
);
end;
/
 CREATE A SCHEDULE
begin
dbms_scheduler.create_schedule
(
schedule_name => 'EVERY_FRIDAY',
repeat_interval => 'FREQ=HOURLY; INTERVAL=6',
comments => 'WEEKLY RMAN BACKUP ON FRIDAY MORING 4 AM'
);
end;
/
  CREATE A JOB
begin
dbms_scheduler.create_job
(
job_name => 'RUN_RMAN_BACKUP',
program_name => 'RMAN_BACKUP',
schedule_name => 'EVERY_FRIDAY',
comments => 'Run this rman script on every friday Morning',
enabled => TRUE
);
end;
/
RUN THE JOB MANUALLY
exec dbms_scheduler.run_job('RUN_RMAN_BACKUP');
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_RMAN_BACKUP';

0 comments:

Post a Comment