| |
 |
|
Oracle dbms_scheduler examples
Oracle Tips by Burleson Consulting |
For more working details and a complete code
depot, see the wonderful $16.95 book
Oracle Job Scheduling
by Dr.
Timothy Hall. You can get the best deal (30%-off by)
buying it directly from the publisher.
Oracle Job Schedulers examples
The following code examples rely on the
previously defined programs and schedules to show how the overloads
of the create_job procedure
are used.
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;
/


For more details, see the book
Oracle Job Scheduling:
Creating robust task
management with dbms_job and Oracle 10g dbms_scheduler, by
Dr. Timothy Hall
|