Hi Most of my experience is with Oracle 9i, so I have never had the chance to use the scheduler before. I created the following schedules, with some help from another web site, but it doesn't seem to run. The schedule is broken down in 3 parts.
--Time schedule part - dbms_scheduler.create_schedule
--Program declaration part - dbms_scheduler.create_program
--Job (conflation) part -dbms_scheduler.create_job
begin
-- run every hour, every day
dbms_scheduler.create_schedule(schedule_name => 'INTERVAL_EVERY_HOUR',
start_date => trunc(sysdate) + 18 / 24,
repeat_interval => 'freq=HOURLY;interval=1',
comments => 'Runtime: Every day every hour');
end;
begin
-- Call a procedure of a database package
dbms_scheduler.create_program(program_name => 'PROG_RUN_REQUISITION',
program_type => 'STORED_PROCEDURE',
program_action => 'SchemaName.PackageName.Procedure_Requisitions',
enabled => true,
comments => 'Procedure to run requisitions');
end;
begin
-- Connect both dbms_scheduler parts by creating the final job
dbms_scheduler.create_job(job_name => 'JOB_RUN_REQUISITION',
program_name => 'PROG_RUN_REQUISITION',
schedule_name => 'INTERVAL_EVERY_HOUR',
enabled => true,
auto_drop => false,
comments => 'Job to run requisitions every 1 hour');
end;
If I launch the schedule immediately, using the script below, it launches successfully.
begin
dbms_scheduler.run_job('JOB_RUN_REQUISITION', TRUE);
end;
The question now is if I need to create s heading, as for normal Functions and Procedures? Or should I save it somehow in my existing package? Or do I need to launch it from some type of windows .bat file (if yes, any tips on how such a bat file would like would be appreciated).
Edited by: MikG on Nov 18, 2010 8:07 AM