DBMS_SCHEDULER

Useful documentation for DBMS_SCHEDULER taken from http://www.dba-oracle.com/t_dbms_scheduler_examples.htm. There is also very good information on the repeat_interval aspect of the scheduler.

freq=secondly, minutely, weekly, monthly or yearly
interval=30 (or whatever)
bymonth, byweekno, byyearday, bymonthday, byday, byhour, byminute, bysecond

So to schedule something to run every 30 min.
repeat_interval => ‘freq=minutely; interval=30’

 
BEGIN
– – Job defined entirely by the CREATE JOB procedure.
DBMS_SCHEDULER.create_job (
job_name => ‘test_full_job_definition’,
job_type => ‘PLSQL_BLOCK’,
job_action => ‘BEGIN my_job_proc(”CREATE_PROGRAM (BLOCK)”); END;’,
start_date => SYSTIMESTAMP,
repeat_interval => ‘freq=hourly; byminute=0’,
end_date => NULL,
enabled => TRUE,
comments => ‘Job defined entirely by the CREATE JOB procedure.’);
END;
/
BEGIN
— Job defined by an existing program and schedule.
DBMS_SCHEDULER.create_job (
job_name => ‘test_prog_sched_job_definition’,
program_name => ‘test_plsql_block_prog’,
schedule_name => ‘test_hourly_schedule’,
enabled => TRUE,
comments => ‘Job defined by an existing program and schedule.’);
END;
/
BEGIN
— Job defined by an existing program and inline schedule.
DBMS_SCHEDULER.create_job (
job_name => ‘test_prog_job_definition’,
program_name => ‘test_plsql_block_prog’,
start_date => SYSTIMESTAMP,
repeat_interval => ‘freq=hourly; byminute=0’,
end_date => NULL,
enabled => TRUE,
comments => ‘Job defined by existing program and inline schedule.’);
END;
/
BEGIN
— Job defined by existing schedule and inline program.
DBMS_SCHEDULER.create_job (
job_name => ‘test_sched_job_definition’,
schedule_name => ‘test_hourly_schedule’,
job_type => ‘PLSQL_BLOCK’,
job_action => ‘BEGIN my_job_proc(”CREATE_PROGRAM (BLOCK)”); END;’,
enabled => TRUE,
comments => ‘Job defined by existing schedule and inline program.’);
END;
/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s