Create Scheduled Jobs

This is the basic syntax for creating a scheduled job, with care taken to ensure that a time zone is specified (in this case, GMT). By specifying a precise start date, you help ensure the job really does run when you intend it to:

begin
 dbms_scheduler.create_job
  (job_name=>'HJR.UPDATE_SOME_MATERIALIZEDVIEWS',
   job_type=>'PLSQL_BLOCK',
   job_action=>'begin dbms_mview.refresh(''HJR.IMPORTANT_MVIEW'');end;',
   start_date=>to_timestamp_tz('12-JAN-2012 02:00:00 +GMT','DD-MON-YYYY HH24:MI:SS TZR'),
   repeat_interval=>'FREQ=DAILY; BYHOUR=2; BYMINUTE=00',
   enabled=>TRUE);
end;

 

Print Friendly

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>