• 10g中表监控与statistics_level


    在10g之前的版本,必须用dbms_stats的ALTER_DATABASE/SCHEMA_TAB_MONITORING过程或者create/alter table ... monitoring打开表的监控,在10g中,MONITORING与NOMONITORING关键字已经过时,如果你在create/alter table中指定表的监控或取消监控,该关键字将忽略,表监控特征被statistics_level控制,当statistics_level等于basic时,将禁止表的监控,如果等于typical或all时,表监控是激活的.

    statistics_level默认是typical,在10g中表监控是激活的,强烈建议在10g中此参数的值是typical.如果STATISTICS_LEVEL设置为basic,不仅不能监控表,而且将禁掉如下一些10g的新功能:
    ASH(Active Session History)
    ASSM(Automatic Shared Memory Management)
    AWR(Automatic Workload Repository)
    ADDM(Automatic Database Diagnostic Monitor)

    监控结果是自上次统计收集以来大概的INSERT/UPDATE/DELETE的记录数,当然这也与sga中维护的记录数有关,每15分钟,smon会刷新统计结果到数据字典中,可以通过如下DBA/ALL/USER_TAB_MODIFICATIONS数据字典查看监控结果,如果想立即看到监控结果,可以用exec dbms_stats.FLUSH_DATABASE_MONITORING_INFO()来刷新数据到数据字典中,oracle使用这些表的数据去判断表的统计数据是否过期,如果当表的数据改变超过10%,oracle就认为该表的统计数据已经过期.

    Example:
    --------
    Let us take an example:

    Step 1:
    -------

    Create table EMP. Its description is as follows

    SQL> desc emp
    SQL> select count(*) from emp;

    COUNT(*)
    ----------
    14

    SQL> select * from user_tab_modifications;

    no rows selected

    Initially there are 14 rows in EMP.

    Step 2:
    -------

    Set parameter STATISTICS_LEVEL='TYPICAL'

    SQL> alter system set STATISTICS_LEVEL='TYPICAL';

    System altered.

    Step 3:
    -------

    Insert additional 14 rows. This will increase the data in EMP by 50% and
    therefore the statistics in EMP will be regarded as stale by Oracle.

    SQL> insert into emp select * from emp;

    14 rows created.
    SQL>commit;

    Step 4:
    -------

    SQL> exec dbms_stats.FLUSH_DATABASE_MONITORING_INFO();

    PL/SQL procedure successfully completed.

    SQL> select * from user_tab_modifications;

    TABLE_NAME PARTITION_NAME
    ------------------------------ ------------------------------
    SUBPARTITION_NAME INSERTS UPDATES DELETES TIMESTAMP TRU
    ------------------------------ ---------- ---------- ---------- --------- ---
    EMP
    14 0 0 16-OCT-03 NO

    Step 5:
    -------

    If a monitored table has been modified more than 10%, then these
    statistics are considered stale

    Analyze the tables whose statistics have become stale using the following command:

    execute DBMS_STATS.GATHER_SCHEMA_STATS ('RAJIV',
    NULL,
    FALSE,
    'FOR ALL COLUMNS SIZE 1',
    NULL,
    'DEFAULT',
    TRUE,
    NULL,
    NULL,
    'GATHER STALE',
    'LIST' );

    Step 6:
    -------

    Query dba_tab_modifications to check whether the table has been analyzed
    or not?

    SQL> select * from user_tab_modifications;

    no rows selected

    No rows in dba_tab_modifications indicates that the table is analyzed.

  • 相关阅读:
    3、MHC主要组织相容性复合体
    2、抗原
    1、免疫细胞
    【转】python3 内循环中遍历map,遍历一遍后再次进入内循环,map为空
    【转】Map 与 Unordered_map
    Chapter7 抑癌基因
    总结 搜索和最短路径问题
    1131 Subway Map DFS解法 BFS回溯!
    python 报错信息汇总
    python str转换成timedelta或date
  • 原文地址:https://www.cnblogs.com/sopost/p/2190154.html
Copyright © 2020-2023  润新知