zoukankan      html  css  js  c++  java
  • Oracle建议关闭自动统计任务中的STA以及段指导

    Oracle建议关闭自动统计任务中的STA以及段指导

    11g中默认启动了三个任务,分别是自动统计信息收集、自动段指导、STA,默认运行时间是周一到周五是运行4小时(22:00->次日2:00),周六日运行20小时(6:00->次日2:00)。

    其中,STA以及段指导可以建议关闭,用处不大。而且必要时可以手工运行。

    关于这几个任务的详细介绍网上够多就不介绍了。

    查看任务状态:

    col client_name for a35
    select client_name,status from dba_autotask_client;
    View Code
    09:48:58 SYS@dbtest(826)> col client_name for a35
    09:49:04 SYS@dbtest(826)> select client_name,status from dba_autotask_client;
    
    CLIENT_NAME                         STATUS
    ----------------------------------- ----------
    auto optimizer stats collection     ENABLED
    auto space advisor                  ENABLED
    sql tuning advisor                  ENABLED

    禁用STA和段指导:

    exec dbms_auto_task_admin.disable(client_name => 'sql tuning advisor',operation => NULL,window_name => NULL);
    
    exec dbms_auto_task_admin.disable (client_name => 'auto space advisor', operation => null, window_name => null);
    PL/SQL procedure successfully completed.
    
    select client_name,status from dba_autotask_client;
    View Code
    14:47:39 SYS@testdb(1203)> exec dbms_auto_task_admin.disable(client_name => 'sql tuning advisor',operation => NULL,window_name => NULL);
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.05
    14:50:20 SYS@testdb(1203)> exec dbms_auto_task_admin.disable (client_name => 'auto space advisor', operation => null, window_name => null);
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.00
    15:02:28 SYS@testdb(1203)> select client_name,status from dba_autotask_client;
    
    CLIENT_NAME                         STATUS
    ----------------------------------- ------------------------
    auto optimizer stats collection     ENABLED
    auto space advisor                  DISABLED
    sql tuning advisor                  DISABLED
    
    Elapsed: 00:00:00.28

    查看自动统计任务的3个任务实际执行内容:

    set line 500
    col PROGRAM_NAME for a35
    col PROGRAM_ACTION for a100
    select program_name,program_action from dba_scheduler_programs where program_name in (select upper(task_name) from DBA_AUTOTASK_TASK);
    View Code
    17:08:56 SYS@testdb(89)> select program_name,program_action from dba_scheduler_programs where program_name in (select upper(task_name) from DBA_AUTOTASK_TASK);
    
    PROGRAM_NAME                        PROGRAM_ACTION
    ----------------------------------- ----------------------------------------------------------------------------------------------------
    AUTO_SQL_TUNING_PROG                DECLARE
                                                 ename VARCHAR2(30);
                                               BEGIN
                                                 ename := dbms_sqltune.execute_tuning_task(
                                                            'SYS_AUTO_SQL_TUNING_TASK');
                                               END;
    
    AUTO_SPACE_ADVISOR_PROG             dbms_space.auto_space_advisor_job_proc
    GATHER_STATS_PROG                   dbms_stats.gather_database_stats_job_proc
    
    Elapsed: 00:00:00.01

    因此有,

    手工执行系统STA:

    exec dbms_sqltune.execute_tuning_task('SYS_AUTO_SQL_TUNING_TASK');

    查看STA结果:

    select dbms_sqltune.report_tuning_task('SYS_AUTO_SQL_TUNING_TASK') from dual;

    手工执行段指导:

    exec dbms_space.auto_space_advisor_job_proc;

    查询段指导结果:

    select tablespace_name, segment_name, segment_type,
         recommendations, c1
         from table(dbms_space.asa_recommendations('TRUE', 'TRUE', 'FALSE'));
  • 相关阅读:
    html页面模板布局内容的继承,block
    url分发
    显示年月,注册页面和后台数据交互,不涉及数据库
    static文件夹中文件引用方式,如html页面引用js
    pycharm写django之返回一个页面
    pycharm编写django第一步
    VUE清除keepalive页面缓存
    js设置html根节点的style字体【Vue动态调整全局字体大小】
    npm 依赖重新安装或更新版本
    antd 自定义表头slots.title不生效
  • 原文地址:https://www.cnblogs.com/PiscesCanon/p/14982440.html
Copyright © 2011-2022 走看看