首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

关于生产库下索引碎片收集的有关问题 <整理 from askmaclean >

2013-02-19 
关于生产库上索引碎片收集的问题 整理 from askmaclean 问题描述:环境:oracle10.2.0.5 RACHP-UX用analyz

关于生产库上索引碎片收集的问题 <整理 from askmaclean >

问题描述:

环境:oracle10.2.0.5 RAC+HP-UX
用analyze index <index_name> validate structure这个语句可以验证索引的碎片程度,然后通过index_stats视图来查询,请问这个语句在生产库上对于比较大的索引使用这个语句,对系统的影响有多大?

FYI:

analyze index <index_name> validate structure


    SQL> create table ttab(t1 int);

    Table created.

    SQL> create index ind_tab on ttab(t1);

    Index created.

    SQL> oradebug setmypid
    Statement processed.
    SQL> oradebug event 10704 trace name context forever,level 10;
    Statement processed.


    SQL> analyze index ind_tab validate structure;

    Index analyzed.

    SQL> oradebug tracefile_name
    /s01/admin/G10R25/udump/g10r25_ora_25784.trc


    [root@vrh8 ~]# grep "ksqgtl \*\*\*" /s01/admin/G10R25/udump/g10r25_ora_25784.trc
    ksqgtl *** TX-00030007-000071e6 mode=6 flags=0x401 timeout=0 ***
    ksqgtl *** TM-00010183-00000000 mode=4 flags=0x401 timeout=0 ***


复制代码

analyze index <index_name> validate structure 要在table上加  TM mode=4的share lock,会block dml

 

 

second:


    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL>  oradebug setmypid
    Statement processed.
    SQL>  oradebug event 10704 trace name context forever,level 10;
    Statement processed.
    SQL> analyze index ind_tab validate structure online;

    Index analyzed.

    SQL> oradebug tracefile_name
    /s01/admin/G10R25/udump/g10r25_ora_25830.trc

    [root@vrh8 ~]# grep "ksqgtl \*\*\*"  /s01/admin/G10R25/udump/g10r25_ora_25830.trc
    ksqgtl *** TX-0009002d-000072d7 mode=6 flags=0x401 timeout=0 ***


    SQL> select * from index_stats;

    no rows selected
复制代码

analyze index ind_tab validate structure online ==> 不要求 表上的 share lock,但是不填充index_stats 视图, 所以  validate structure online  只能用来验证索引上是否存在讹误

 

热点排行