对于11g版本的oracle 有三个自动维护定时任务。
1 自动优化器统计收集:为所有方案对象收集陈旧的或缺少的统计数据,所收集的统计信息将被用来提高sql的执行的性能,任务名是“auto optimizer stats collection”
2 自动分段顾问:标识数据库中的段是否有可以回收的空间,并以此信息统计为基础做出怎样整理段的碎片以节约空间。你也可以手动的执行此job来获取最新的建议信息,或者获取自动段advisor 不检测的但又可以回收的段的信息,任务名是“auto space advisor”
3 自动SQL调整顾问:自动标识并尝试调整高负载的SQL,任务名是“sql tuning advisor”
sys@RAC> select client_name ,status from DBA_AUTOTASK_CLIENT;
CLIENT_NAME STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection ENABLED
auto space advisor ENABLED
sql tuning advisor ENABLED
管理自动维护的job
在oracle 10g中这些job被分别创建并且以DBA_SCHEDULER_JOBS.JOB_NAME的名称出现
然而在11g中则有所改变,通过视图DBA_AUTOTASK_WINDOW_CLIENTS可以查看他们一周七天的执行情况,包括
时间窗口,下次执行时间,job的名称,健康检查
sys@RAC> select * from DBA_AUTOTASK_WINDOW_CLIENTS;
WINDOW_NAME WINDOW_NEXT_TIME WINDO AUTOTASK OPTIMIZE SEGMENT_ADVISOR SQL_TUNE HEALTH_M
------------------ ---------------------------------- ----- -------- -------- --------------- -------- --------
WEDNESDAY_WINDOW 28-SEP-11 10.00.00.000000 PM PRC FALSE DISABLED ENABLED ENABLED ENABLED DISABLED
SATURDAY_WINDOW 01-OCT-11 06.00.00.000000 AM PRC FALSE DISABLED ENABLED ENABLED ENABLED DISABLED
THURSDAY_WINDOW 29-SEP-11 10.00.00.000000 PM PRC FALSE DISABLED ENABLED ENABLED ENABLED DISABLED
TUESDAY_WINDOW 27-SEP-11 10.00.00.000000 PM PRC FALSE DISABLED ENABLED ENABLED ENABLED DISABLED
SUNDAY_WINDOW 02-OCT-11 06.00.00.000000 AM PRC FALSE DISABLED ENABLED ENABLED ENABLED DISABLED
MONDAY_WINDOW 03-OCT-11 10.00.00.000000 PM PRC FALSE DISABLED ENABLED ENABLED ENABLED DISABLED
FRIDAY_WINDOW 30-SEP-11 10.00.00.000000 PM PRC FALSE DISABLED ENABLED ENABLED ENABLED DISABLED
7 rows selected.
DBMS_AUTO_TASK_ADMIN包的ENABLE和DISABLE存储过程能够实现关闭或者开启的三种job(不要任何参数):
execute DBMS_AUTO_TASK_ADMIN.DISABLE;
execute DBMS_AUTO_TASK_ADMIN.ENABLE;
关闭指定的job
BEGIN
dbms_auto_task_admin.disable(
client_name => 'sql tuning advisor',
peration => NULL,
window_name => NULL);
END;
/
开启指定的job:
BEGIN
dbms_auto_task_admin.enable(
client_name => 'sql tuning advisor',
peration => NULL,
window_name => NULL);
END;
/
关闭周三sql优化器顾问的执行窗口
sys@RAC> BEGIN
2 dbms_auto_task_admin.disable(
3 client_name => 'sql tuning advisor',
4 peration => NULL,
5 window_name => 'MONDAY_WINDOW');
6 END;
7 /
PL/SQL procedure successfully completed.
sys@RAC> select * from DBA_AUTOTASK_WINDOW_CLIENTS;
WINDOW_NAME WINDOW_NEXT_TIME WINDO AUTOTASK OPTIMIZE SEGMENT_ADVISOR SQL_TUNE HEALTH_M
------------------ ---------------------------------- ----- -------- -------- -------------------- -------- --------
WEDNESDAY_WINDOW 28-SEP-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
SATURDAY_WINDOW 01-OCT-11 06.00.00.000000 AM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
THURSDAY_WINDOW 29-SEP-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
TUESDAY_WINDOW 27-SEP-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
SUNDAY_WINDOW 02-OCT-11 06.00.00.000000 AM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
MONDAY_WINDOW 03-OCT-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED DISABLED DISABLED
FRIDAY_WINDOW 30-SEP-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
7 rows selected.
关闭星期天的自动段顾问job的时间窗口:
sys@RAC> BEGIN
2 dbms_auto_task_admin.disable(
3 client_name => 'auto space advisor',
4 peration => NULL,
5 window_name => 'SUNDAY_WINDOW');
6 END;
7 /
PL/SQL procedure successfully completed.
sys@RAC> select * from DBA_AUTOTASK_WINDOW_CLIENTS;
WINDOW_NAME WINDOW_NEXT_TIME WINDO AUTOTASK OPTIMIZE SEGMENT_ADVISOR SQL_TUNE HEALTH_M
------------------ ---------------------------------- ----- -------- -------- -------------------- -------- --------
WEDNESDAY_WINDOW 28-SEP-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
SATURDAY_WINDOW 01-OCT-11 06.00.00.000000 AM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
THURSDAY_WINDOW 29-SEP-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
TUESDAY_WINDOW 27-SEP-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
SUNDAY_WINDOW 02-OCT-11 06.00.00.000000 AM PRC FALSE ENABLED ENABLED DISABLED ENABLED DISABLED
MONDAY_WINDOW 03-OCT-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED DISABLED DISABLED
FRIDAY_WINDOW 30-SEP-11 10.00.00.000000 PM PRC FALSE ENABLED ENABLED ENABLED ENABLED DISABLED
7 rows selected.
更详细的信息请看:
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e23448/d_autotaskadm.htm#ARPLS032
sys@RAC>
10g 和 11g 中的对比信息 :
Subject 10g 11g
Jobs 以不同的job显示在 自动维护进程有一个'ORA$AT'前缀并且
DBA_SCHEDULER_JOBS中 一旦执行,则只是显示一个job而非多个!
Maintenance 10g有两个维护窗口
Window WEEKNIGHT and WEEKEND 每天有自己的时间窗口
Resource 默认不启用 为每周的窗口预定义资源计划
manager
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22664653/viewspace-708399/,如需转载,请注明出处,否则将追究法律责任。