Begin
dbms_scheduler.create_schedule(
repeat_interval => 'FREQ=DAILY;BYHOUR=4;BYMINUTE=0;BYSECOND=0',
start_date => systimestamp at time zone 'PRC',
comments => '---this is my test schedule---',
schedule_name => 'MYTEST_SCHEDULE');
end;
|
BEGIN
DBMS_SCHEDULER.CREATE_PROGRAM(
program_name=>'mytest_program_1',
program_action=>'update mytest set id=id+1;',
program_type=>'PLSQL_BLOCK',
number_of_arguments=>0,
comments=>'',
enabled=>TRUE);
END;
|
BEGIN
dbms_scheduler.create_chain(
chain_name =>'MYTEST_CHAIN');
dbms_scheduler.define_chain_step(
chain_name =>'MYTEST_CHAIN',
step_name =>'mytest_chain_1',
program_name =>'P_1');
dbms_scheduler.alter_chain(
chain_name =>'MYTEST_CHAIN',
step_name =>'mytest_chain_1',
attribute=>'skip',
value=>FALSE);
dbms_scheduler.define_chain_step(
chain_name =>'MYTEST_CHAIN',
step_name =>'mytest_chain_2',
program_name =>'P_2');
dbms_scheduler.alter_chain(
chain_name =>'MYTEST_CHAIN',
step_name =>'mytest_chain_2',
attribute=>'skip',
value=>FALSE);
dbms_scheduler.enable('MYTEST_CHAIN');
END;
|
BEGIN
dbms_scheduler.create_job_class(
logging_level => DBMS_SCHEDULER.LOGGING_RUNS,
log_history => 100,
resource_consumer_group => 'AUTO_TASK_CONSUMER_GROUP',
job_class_name => 'MYTEST_JOB_CLASS');
END;
|
BEGIN
DBMS_SCHEDULER.CREATE_WINDOW(
window_name=>'mytest_windows_1',
resource_plan=>'SYSTEM_PLAN',
schedule_name=>'SYS.DAILY_PURGE_SCHEDULE',
duration=>numtodsinterval(240, 'minute'),
window_priority=>'LOW',
comments=>'');
END;
|
BEGIN
DBMS_SCHEDULER.CREATE_WINDOW_GROUP(
group_name=>'mytest_window_group',
window_list=>'MYTEST_WINDOWS_1,WEEKEND_WINDOW');
END;
|
BEGIN
dbms_scheduler.create_job(
job_name => ' MYTEST_JOB_1',
job_type => 'PLSQL_BLOCK',
job_action => 'update mytest set id=id+1;',
repeat_interval => 'FREQ=MINUTELY;INTERVAL=10',
start_date => sysdate,
auto_drop => FALSE,
enabled => TRUE);
END;
|
BEGIN
dbms_scheduler.create_job(
job_name => 'MYTEST_JOB_2',
job_type => 'CHAIN',
job_action => 'MYTEST_CHAIN',
schedule_name => 'SYS.MYTEST_WINDOW_GROUP',
job_class => 'DEFAULT_JOB_CLASS',
auto_drop => FALSE,
enabled => FALSE);
dbms_scheduler.set_attribute( name => 'MYTEST_JOB_2', attribute => 'stop_on_window_close', value => FALSE);
END;
|
BEGIN
dbms_scheduler.set_attribute( name => 'DAILY_PURGE_SCHEDULE', attribute => 'repeat_interval', value => 'FREQ=DAILY;BYHOUR=1;BYMINUTE=0;BYSECOND=0');
END;
|
BEGIN
DBMS_SCHEDULER.SET_ATTRIBUTE(
name=>'P_1',
attribute=>'PROGRAM_ACTION',
value=>'/backup/2sh');
END;
|
BEGIN
dbms_scheduler.set_attribute_null( name => 'GATHER_STATS_JOB', attribute => 'schedule_name');
dbms_scheduler.set_attribute( name => 'GATHER_STATS_JOB', attribute => 'repeat_interval', value => 'FREQ=DAILY;BYHOUR=2;BYSECOND=0');
END;
|
SQL> select VIEW_NAME from dba_views a where a.view_name like 'DBA_SCHEDULER%';
VIEW_NAME
------------------------------
DBA_SCHEDULER_PROGRAMS
DBA_SCHEDULER_JOBS
DBA_SCHEDULER_JOB_CLASSES
DBA_SCHEDULER_WINDOWS
DBA_SCHEDULER_PROGRAM_ARGS
DBA_SCHEDULER_JOB_ARGS
DBA_SCHEDULER_JOB_LOG
DBA_SCHEDULER_JOB_RUN_DETAILS
DBA_SCHEDULER_WINDOW_LOG
DBA_SCHEDULER_WINDOW_DETAILS
DBA_SCHEDULER_WINDOW_GROUPS
DBA_SCHEDULER_WINGROUP_MEMBERS
DBA_SCHEDULER_SCHEDULES
DBA_SCHEDULER_RUNNING_JOBS
DBA_SCHEDULER_GLOBAL_ATTRIBUTE
DBA_SCHEDULER_CHAINS
DBA_SCHEDULER_CHAIN_RULES
DBA_SCHEDULER_CHAIN_STEPS
DBA_SCHEDULER_RUNNING_CHAINS
|