11g dba_scheduler_jobs


Oracle 11g 数据库有三个预定义自动维护任务:

Automatic Optimizer Statistics Collection(自动优化器统计信息收集)

收集数据库中所有无统计信息或仅有过时统计信息的 Schema 对象的 Optimizer(优化器)统计信息。SQL query optimizer(SQL 查询优化器)使用此任务收集的统计信息提高 SQL 执行的性能。


Automatic Segment Advisor(自动段指导)

识别有可用回收空间的段,并提出如何消除这些段中的碎片的建议。您也可以手动运行 Segment Advisor 获取更多最新建议,或获取 Automatic Segment Advisor 没有检查到的那些有可能做空间回收的段的建议。


Automatic SQL Tuning Advisor(自动 SQL 优化指导)

检查高负载 SQL 语句的性能,并提出如何优化这些语句的建议。您可以配置此指导,自动应用建议的SQL profile。



Standard 11g jobs are:
  • the 10g jobs
  • ORA$AUTOTASK_CLEAN
  • HM_CREATE_OFFLINE_DICTIONARY
  • DRA_REEVALUATE_OPEN_FAILURES
  • MGMT_CONFIG_JOB
  • MGMT_STATS_CONFIG_JOB
  • BSLN_MAINTAIN_STATS_JOB
  • XMLDB_NFS_CLEANUP_JOB
  • RSE$CLEAN_RECOVERABLE_SCRIPT
  • SM$CLEAN_AUTO_SPLIT_MERGE
1. ORA$AUTOTASK_CLEAN 
The job is created by the 11g script catmwin.sql - Catalog script for Maintenance WINdow
catmwin.sql defines maintenance window and stats collection job. This job is an autotask repository data ageing job and deletes obsolete AUTOTASK repository data. The delete of this old data will be performed by the procedure ora$age_autotask_data which will be executed by the job.

2. HM_CREATE_OFFLINE_DICTIONARY 
The job is created by the 11g script catmwin.sql which mentions that this is a job for creation of offline dictionary for Database Repair Advisor.
From unpublished Note 602459.1 - 'What Is OFFLINE_DICTIONARY': 'The system job SYS.HM_CREATE_OFFLINE_DICTIONARY executes the dbms_hm.create_offline_dictionary package which creates a LogMiner offline dictionary in the ADR for DRA name translation service. The job for generating the logminer dictionary is scheduled during the maintenance window. This job can be disabled. '

3. DRA_REEVALUATE_OPEN_FAILURES 
The job is created by the 11g script catmwin.sql which mentions that this is a job for reevaluate open failures for Database Recovery Advisor. In other words it is used to get assistance in case of loss or corruption of datafiles, redo log files or controlfiles.
The job executes the procedure dbms_ir.reevaluateopenfailures. 
Note.466682.1  - 'Data Recovery Advisor -Reference Guide'.

4. MGMT_CONFIG_JOB - comes with the OCM(Oracle Configuration Manager) installation - This is a configuration collection job. 
The job is created by the script ocmjb10.sql by running procedure 'ORACLE_OCM.MGMT_CONFIG.collect_config'.

5. MGMT_STATS_CONFIG_JOB 
This is an OCM Statistics collection job created in ocmjb10.sql by running 'ORACLE_OCM.MGMT_CONFIG.collect_stats'.

6. BSLN_MAINTAIN_STATS_JOB 
This job is a compute statistics job. This job runs the  BSLN_MAINTAIN_STATS_PROG program on the BSLN_MAINTAIN_STATS_SCHED schedule. The program BSLN_MAINTAIN_STATS_PROG will keep the default baseline's statistics up-to-date.

7. XMLDB_NFS_CLEANUP_JOB 
The job is created in xdbu102.sql and runs the procedure dbms_xdbutil_int.cleanup_expired_nfsclients.

8. RSE$CLEAN_RECOVERABLE_SCRIPT - this job is STREAMS related.
It is created in execstr.sql and is new in 11.2. The script execstr.sql executes anonymous blocks for STReam. The job is responsible with the cleaning of recoverable scripts and calls 'sys.dbms_streams_auto_int.clean_recoverable_script;'.

9. SM$CLEAN_AUTO_SPLIT_MERGE - this job is STREAMS related. It is created in file execstr.sql and is new in 11.2 too. The job is responsible with the cleaning of auto split merge views.



============================================================================================================================

它们在 Oracle10g 中为独立作业,且在 DBA_SCHEDULER_JOBS.JOB_NAME 中可见。

这在 Oracle11g 中有所更改。相关视图为 DBA_AUTOTASK_WINDOW_CLIENTS。
现在,这些作业只有当被真正执行时,才在 DBA_SCHEDULER_JOBS 中可见,且名称为系统生成的名称。

SQL> desc DBA_AUTOTASK_WINDOW_CLIENTS
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 WINDOW_NAME                               NOT NULL VARCHAR2(30)
 WINDOW_NEXT_TIME                                   TIMESTAMP(6) WITH TIME ZONE
 WINDOW_ACTIVE                                      VARCHAR2(5)
 AUTOTASK_STATUS                                    VARCHAR2(8)
 OPTIMIZER_STATS                                    VARCHAR2(8)
 SEGMENT_ADVISOR                                    VARCHAR2(8)
 SQL_TUNE_ADVISOR                                   VARCHAR2(8)
 HEALTH_MONITOR                                     VARCHAR2(8)

 select * from DBA_AUTOTASK_WINDOW_CLIENTS;

WINDOW_NAME
------------------------------
WINDOW_NEXT_TIME
---------------------------------------------------------------------------
WINDO AUTOTASK OPTIMIZE SEGMENT_ SQL_TUNE HEALTH_M
----- -------- -------- -------- -------- --------
MONDAY_WINDOW
08-DEC-08 10.00.00.000000 PM EUROPE/VIENNA
FALSE ENABLED ENABLED ENABLED ENABLED DISABLED

...

SUNDAY_WINDOW
07-DEC-08 06.00.00.000000 AM EUROPE/VIENNA
FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
7 rows selected.


要启用或禁用所有窗口的所有自动维护任务,在不使用任何参数的情况下调用 ENABLE 或 DISABLE 程序。

SQL> execute DBMS_AUTO_TASK_ADMIN.DISABLE;


要禁用特定维护任务,使用 DISABLE 程序,如下所示:

SQL> BEGIN
       dbms_auto_task_admin.disable(
       client_name => 'sql tuning advisor',
       operation => NULL,
       window_name => NULL);
     END;  
    /


要再次启用该特定维护任务,使用 ENABLE 程序,如下所示:

SQL> BEGIN
       dbms_auto_task_admin.enable(
       client_name => 'sql tuning advisor',
       operation => NULL,
       window_name => NULL);
     END;
     /



client_name 参数使用的任务名称列在 DBA_AUTOTASK_CLIENT 数据库字典视图中。

示例:
auto optimizer stats collection
auto space advisor
sql tuning advisor



另一个差异是预定义调度程序窗口:

  •   Oracle10g : WEEKNIGHT_WINDOW and WEEKEND_WINDOW
  •   Oracle11g : MONDAY_WINDOW .... SUNDAY_WINDOW. 

为了向下兼容,WEEKNIGHT_WINDOW 和 WEEKEND_WINDOW 仍然存在。

窗口打开持续的时间在 11g 中有所更改。星期一到星期五从晚上 10 点到凌晨 2 点,星期六到星期日从上午 6 点到凌晨 2 点。

您可以使用 DBMS_SCHEDULER.SET_ATTRIBUTE 程序调整预定义维护窗口时间,使其适用于您的数据库环境。
示例:以下脚本将 WEEKNIGHT_WINDOW 改为每个工作日从午夜至上午 8 点(窗口持续时间为 8 小时不变):
EXECUTE DBMS_SCHEDULER.SET_ATTRIBUTE(
'WEEKNIGHT_WINDOW', 
'repeat_interval',
'freq=daily;byday=MON, TUE, WED, THU, FRI;byhour=0;byminute=0;bysecond=0');

每个窗口还有一个名为 DEFAULT_MAINTENANCE_PLAN 的预定义资源计划,一旦打开相关窗口,该计划将激活。这是 10g 和 11g 之间的另一个差异。


SQL> select window_name, resource_plan from dba_scheduler_windows;

WINDOW_NAME                    RESOURCE_PLAN
------------------------------ ------------------------------
MONDAY_WINDOW                  DEFAULT_MAINTENANCE_PLAN
TUESDAY_WINDOW                 DEFAULT_MAINTENANCE_PLAN
WEDNESDAY_WINDOW               DEFAULT_MAINTENANCE_PLAN
THURSDAY_WINDOW                DEFAULT_MAINTENANCE_PLAN
FRIDAY_WINDOW                  DEFAULT_MAINTENANCE_PLAN
SATURDAY_WINDOW                DEFAULT_MAINTENANCE_PLAN
SUNDAY_WINDOW                  DEFAULT_MAINTENANCE_PLAN
WEEKNIGHT_WINDOW
WEEKEND_WINDOW

9 rows selected.


SQL> select * from dba_rsrc_plans where plan='DEFAULT_MAINTENANCE_PLAN'
PLAN_ID PLAN NUM_PLAN_DIRECTIVES
---------- ------------------------------ -------------------
CPU_METHOD MGMT_METHOD
------------------------------ ------------------------------
ACTIVE_SESS_POOL_MTH PARALLEL_DEGREE_LIMIT_MTH
------------------------------ ------------------------------
QUEUEING_MTH SUB
------------------------------ ---
COMMENTS
--------------------------------------------------------------------------------
STATUS MAN
------------------------------ ---
11187 DEFAULT_MAINTENANCE_PLAN 4
EMPHASIS EMPHASIS
ACTIVE_SESS_POOL_ABSOLUTE PARALLEL_DEGREE_LIMIT_ABSOLUTE
FIFO_TIMEOUT NO
Default plan for maintenance windows that prioritizes SYS_GROUP operations and a
llocates the remaining 5% to diagnostic operations and 25% to automated maintena
nce operations.
YES


SQL> select * from DBA_RSRC_PLAN_DIRECTIVES where plan='DEFAULT_MAINTENANCE_PLAN';

PLAN GROUP_OR_SUBPLAN TYPE
------------------------------ ------------------------------ --------------
CPU_P1 CPU_P2 CPU_P3 CPU_P4 CPU_P5 CPU_P6 CPU_P7
---------- ---------- ---------- ---------- ---------- ---------- ----------
CPU_P8 MGMT_P1 MGMT_P2 MGMT_P3 MGMT_P4 MGMT_P5 MGMT_P6
---------- ---------- ---------- ---------- ---------- ---------- ----------
MGMT_P7 MGMT_P8 ACTIVE_SESS_POOL_P1 QUEUEING_P1 PARALLEL_DEGREE_LIMIT_P1
---------- ---------- ------------------- ----------- ------------------------
SWITCH_GROUP SWITC SWITCH_TIME SWITCH_IO_MEGABYTES
------------------------------ ----- ----------- -------------------
SWITCH_IO_REQS SWITC MAX_EST_EXEC_TIME UNDO_POOL MAX_IDLE_TIME
-------------- ----- ----------------- ---------- -------------
MAX_IDLE_BLOCKER_TIME SWITCH_TIME_IN_CALL
--------------------- -------------------
COMMENTS
--------------------------------------------------------------------------------
STATUS MAN
------------------------------ ---
DEFAULT_MAINTENANCE_PLAN SYS_GROUP CONSUMER_GROUP
100 0 0 0 0 0 0
0 100 0 0 0 0 0
0 0
FALSE
FALSE

Directive for system operations
NO

DEFAULT_MAINTENANCE_PLAN OTHER_GROUPS CONSUMER_GROUP
0 70 0 0 0 0 0
0 0 70 0 0 0 0
0 0
FALSE
FALSE

Directive for all other operations
NO

DEFAULT_MAINTENANCE_PLAN ORA$AUTOTASK_SUB_PLAN PLAN
0 25 0 0 0 0 0
0 0 25 0 0 0 0
0 0
FALSE
FALSE

Directive for automated maintenance tasks
NO

DEFAULT_MAINTENANCE_PLAN ORA$DIAGNOSTICS CONSUMER_GROUP
0 5 0 0 0 0 0
0 0 5 0 0 0 0
0 0
FALSE
FALSE

Directive for automated diagnostic tasks
NO


10g 与 11g 之间变化的摘要:

主题 10g 11g
作业 在 DBA_SCHEDULER_JOBS 中独立作业 AUTOTASKS 有命名前缀“ORA$AT”,且只有作业执行后才可见
维护窗口 2 个窗口:WEEKNIGHT 和 WEEKEND 每天有不同的窗口
Resource manager 默认不启用 每个窗口都有预定义资源计划
     

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值