查看任务状态 select client_name,status from dba_autotask_client; 修改窗口执行开始时间和持续时间 begin dbms_scheduler.disable( name => 'SUNDAY_WINDOW', force => TRUE); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."SUNDAY_WINDOW"',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=SUN;byhour=1;byminute=0; bysecond=0'); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."SUNDAY_WINDOW"',attribute=>'DURATION',value=>numtodsinterval(240, 'minute')); dbms_scheduler.enable( name => 'SUNDAY_WINDOW'); dbms_scheduler.disable( name => 'SATURDAY_WINDOW', force => TRUE); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."SATURDAY_WINDOW"',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=SAT;byhour=1;byminute=0; bysecond=0'); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."SATURDAY_WINDOW"',attribute=>'DURATION',value=>numtodsinterval(240, 'minute')); dbms_scheduler.enable( name => 'SATURDAY_WINDOW'); dbms_scheduler.disable( name => 'FRIDAY_WINDOW', force => TRUE); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."FRIDAY_WINDOW"',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=FRI;byhour=1;byminute=0; bysecond=0'); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."FRIDAY_WINDOW"',attribute=>'DURATION',value=>numtodsinterval(240, 'minute')); dbms_scheduler.enable( name => 'FRIDAY_WINDOW'); dbms_scheduler.disable( name => 'THURSDAY_WINDOW', force => TRUE); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."THURSDAY_WINDOW"',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=THU;byhour=1;byminute=0; bysecond=0'); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."TUESDAY_WINDOW"',attribute=>'DURATION',value=>numtodsinterval(240, 'minute')); dbms_scheduler.enable( name => 'THURSDAY_WINDOW'); dbms_scheduler.disable( name => 'WEDNESDAY_WINDOW', force => TRUE); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."WEDNESDAY_WINDOW"',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=WED;byhour=1;byminute=0; bysecond=0'); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."WEDNESDAY_WINDOW"',attribute=>'DURATION',value=>numtodsinterval(240, 'minute')); dbms_scheduler.enable( name => 'WEDNESDAY_WINDOW'); dbms_scheduler.disable( name => 'TUESDAY_WINDOW', force => TRUE); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."TUESDAY_WINDOW"',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=TUE;byhour=1;byminute=0; bysecond=0'); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."TUESDAY_WINDOW"',attribute=>'DURATION',value=>numtodsinterval(240, 'minute')); dbms_scheduler.enable( name => 'TUESDAY_WINDOW'); dbms_scheduler.disable( name => 'MONDAY_WINDOW', force => TRUE); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."MONDAY_WINDOW"',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=MON;byhour=1;byminute=0; bysecond=0'); DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'"SYS"."MONDAY_WINDOW"',attribute=>'DURATION',value=>numtodsinterval(240, 'minute')); dbms_scheduler.enable( name => 'MONDAY_WINDOW'); end; / 查看窗口执行时间和持续时间 select * from dba_scheduler_windows;
查看历史执行情况
SELECT a.CLIENT_NAME,a.WINDOW_START_TIME,a.WINDOW_DURATION FROM dba_autotask_client_history a WHERE client_name like '%stats%';