码迷,mamicode.com
首页 > 数据库 > 详细

oracle常规任务

时间:2015-10-26 18:46:49      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:

# 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‘);

版权声明:本文博主原创文章,博客,未经同意不得转载。

oracle常规任务

标签:

原文地址:http://www.cnblogs.com/gcczhongduan/p/4911954.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!