# su - oracle
oracle> sqlplus "/as sysdba"
SQL> exec dbms_scheduler.disable('MONDAY_WINDOW');
SQL> exec dbms_scheduler.disable('TUESDAY_WINDOW');
SQL> exec dbms_scheduler.disable('WEDNESDAY_WINDOW');
SQL> exec dbms_scheduler.disable('THURSDAY_WINDOW');
SQL> exec dbms_scheduler.disable('FRIDAY_WINDOW');
SQL> exec dbms_scheduler.disable('SATURDAY_WINDOW');
SQL> exec dbms_scheduler.disable('SUNDAY_WINDOW');
SQL> exec dbms_scheduler.disable('WEEKEND_WINDOW');
# su - oracle
oracle> sqlplus "/as sysdba"
SQL> exec dbms_scheduler.enable('MONDAY_WINDOW');
SQL> exec dbms_scheduler.enable('TUESDAY_WINDOW');
SQL> exec dbms_scheduler.enable('WEDNESDAY_WINDOW');
SQL> exec dbms_scheduler.enable('THURSDAY_WINDOW');
SQL> exec dbms_scheduler.enable('FRIDAY_WINDOW');
SQL> exec dbms_scheduler.enable('SATURDAY_WINDOW');
SQL> exec dbms_scheduler.enable('SUNDAY_WINDOW');
關閉oracle定時任務
1 Set the current resource manager plan to null (or another plan that is not restrictive):
alter system set resource_manager_plan='' scope=both;
2 Change the active windows to use the null resource manager plan (or other nonrestrictive plan) using:
execute dbms_scheduler.set_attribute('WEEKNIGHT_WINDOW','RESOURCE_PLAN','');
execute dbms_scheduler.set_attribute('WEEKEND_WINDOW','RESOURCE_PLAN','');
3 Then, for each window_name (WINDOW_NAME from DBA_SCHEDULER_WINDOWS), run:
execute dbms_scheduler.set_attribute('<window name>','RESOURCE_PLAN','');
SQL> select * from DBA_SCHEDULER_WINDOWS;
4 open resources plan
Check the resource status(Maybe need to set NULL or Change the running time. Please contact with the product engineers to confirm)
SQL> select a.name, a.value from v$parameter a where a.name = 'resource_manager_plan';
SQL> select window_name, resource_plan from dba_scheduler_windows where resource_plan is not null;
If not NULL, please think about Change the running time by the following:
begin
dbms_scheduler.set_attribute(name=>'MONDAY_WINDOW',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=MON;byhour=3;byminute=0; bysecond=0');
dbms_scheduler.set_attribute(name=>'TUESDAY_WINDOW',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=TUE;byhour=3;byminute=0; bysecond=0');
dbms_scheduler.set_attribute(name=>'WEDNESDAY_WINDOW',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=WED;byhour=3;byminute=0; bysecond=0');
dbms_scheduler.set_attribute(name=>'THURSDAY_WINDOW',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=THU;byhour=3;byminute=0; bysecond=0');
dbms_scheduler.set_attribute(name=>'FRIDAY_WINDOW',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=FRI;byhour=3;byminute=0; bysecond=0');
end;
/
begin
dbms_scheduler.set_attribute(name=>'SATURDAY_WINDOW',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=SAT;byhour=3;byminute=0; bysecond=0');
dbms_scheduler.set_attribute(name=>'SATURDAY_WINDOW',attribute=>'DURATION',value=>'+000 04:00:00');
dbms_scheduler.set_attribute(name=>'SUNDAY_WINDOW',attribute=>'REPEAT_INTERVAL',value=>'freq=daily;byday=SUN;byhour=3;byminute=0; bysecond=0');
dbms_scheduler.set_attribute(name=>'SUNDAY_WINDOW',attribute=>'DURATION',value=>'+000 04:00:00');
end;
/
exec DBMS_SCHEDULER.SET_SCHEDULER_ATTRIBUTE('default_timezone','ASIA/TASHKENT');