<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    姿姿霸霸~~!
    貴在堅(jiān)持!
    posts - 106,  comments - 50,  trackbacks - 0
    1.對(duì)索引結(jié)構(gòu)進(jìn)行統(tǒng)計(jì)
    1.1analyze index indexname validate structure
    聯(lián)機(jī)文檔的原文:Specify VALIDATE STRUCTURE to validate the structure of the analyzed object. 
    The statistics collected by this clause are not used by the Oracle Database optimizer, as are statistics collected by the COMPUTE STATISTICS and ESTIMATE STATISTICS clauses.
    For an index, Oracle Database verifies the integrity of each data block in the index and checks for block corruption. This clause does not confirm that each row in the table has an index entry or that each index entry points to a row in the table. You can perform these operations by validating the structure of the table with the CASCADE clause.
    這個(gè)命令主要是用來分析索引的數(shù)據(jù)塊是否有壞塊,以及根據(jù)分析得到的數(shù)據(jù)(存放在index_stats)來判斷索引是否需要重新建立。
    1.2 validate structure有二中模式:online, offline, 默認(rèn)是offline模式。
    聯(lián)機(jī)文檔原文:
    Specify ONLINE to enable Oracle Database to run the validation while DML operations are ongoing within the object. The database reduces the amount of validation performed to allow for concurrency.
    Specify OFFLINE, to maximize the amount of validation performed. This setting prevents INSERT, UPDATE, and DELETE statements from concurrently accessing the object during validation but allows queries. This is the default.
    Restriction on ONLINE
    You cannot specify ONLINE when analyzing a cluster or index.
    Note:
    When you validate the structure of an object ONLINE, Oracle Database does not collect any statistics, as it does when you validate the structure of the object OFFLINE.
    以offline模式分析時(shí),會(huì)對(duì)表加一個(gè)4級(jí)別的鎖(表共享),對(duì)run系統(tǒng)可能造成一定的影響。
    而online模式則沒有表lock的影響,但當(dāng)以online模式分析時(shí), 在視圖index_stats沒有統(tǒng)計(jì)信息。
    2.對(duì)索引狀態(tài)進(jìn)行統(tǒng)計(jì)
    analyze index indexname compute statistics
    聯(lián)機(jī)文檔原文:
    COMPUTE STATISTICS instructs Oracle Database to compute exact statistics about the analyzed object and store them in the data dictionary. When you analyze a table, both table and column statistics are collected.
    Both computed and estimated statistics are used by the Oracle Database optimizer to choose the execution plan for SQL statements that access analyzed objects. These statistics may also be useful to application developers who write such statements.
    Column statistics appear in the data dictionary views USER_TAB_COLUMNS, ALL_TAB_COLUMNS, and DBA_TAB_COLUMNS. Histograms appear in the data dictionary views USER_TAB_HISTOGRAMS, DBA_TAB_HISTOGRAMS, and ALL_TAB_HISTOGRAMS; USER_PART_HISTOGRAMS, DBA_PART_HISTOGRAMS, and ALL_PART_HISTOGRAMS; and USER_SUBPART_HISTOGRAMS, DBA_SUBPART_HISTOGRAMS, and ALL_SUBPART_HISTOGRAMS.
    總的來說,compute statistics是用來統(tǒng)計(jì)index的分析信息,來為CBO服務(wù)的。9i之后推薦使用dbms_stats。
    ps:
    for table的統(tǒng)計(jì)信息存在于視圖:user_tables 、all_tables、dba_tables
    for all indexes的統(tǒng)計(jì)信息存在于視圖: user_indexes 、all_indexes、dba_indexes
    for all columns的統(tǒng)計(jì)信息存在于試圖:user_tab_columns、all_tab_columns、dba_tab_columns
    3.一些sample
    3.1使用validate structure分析一個(gè)索引是否需要重建
    (1)analyze index index_name validate structure;
    (2)select t.del_lf_rows_len /t.lf_blk_len from index_stats t where t.name = &index_name;
    (3)如果結(jié)果大于20%,index就需要被rebuild了。
    4.對(duì)于分區(qū)表,建議使用DBMS_STATS,而不是使用Analyze語句。
    (1)可以并行進(jìn)行,對(duì)多個(gè)用戶,多個(gè)Table
    (2)可以得到整個(gè)分區(qū)表的數(shù)據(jù)和單個(gè)分區(qū)的數(shù)據(jù)。
    (3)可以在不同級(jí)別上Compute Statistics:?jiǎn)蝹€(gè)分區(qū),子分區(qū),全表,所有分區(qū)
    (4)可以導(dǎo)出統(tǒng)計(jì)信息
    (5)可以用戶自動(dòng)收集統(tǒng)計(jì)信息
    5.DBMS_STATS的缺點(diǎn)
    (1)不能Validate Structure
    (2)不能收集CHAINED ROWS, 不能收集CLUSTER TABLE的信息,這兩個(gè)仍舊需要使用Analyze語句。
    (3)DBMS_STATS 默認(rèn)不對(duì)索引進(jìn)行Analyze,因?yàn)槟J(rèn)Cascade是False,需要手工指定為True
    6.對(duì)于oracle 9里面的External Table,Analyze不能使用,只能使用DBMS_STATS來收集信息。
    posted on 2011-09-13 10:31 xrzp 閱讀(384) 評(píng)論(0)  編輯  收藏 所屬分類: oracle-基礎(chǔ)

    <2011年9月>
    28293031123
    45678910
    11121314151617
    18192021222324
    2526272829301
    2345678

    常用鏈接

    留言簿(4)

    隨筆分類

    隨筆檔案

    好友的blog

    搜索

    •  

    積分與排名

    • 積分 - 118094
    • 排名 - 499

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 久久精品熟女亚洲av麻豆| 18禁男女爽爽爽午夜网站免费| 亚洲精品美女在线观看播放| 免费va人成视频网站全| 精品久久久久久久久免费影院| 成人久久免费网站| 美女被羞羞网站免费下载| 亚洲高清视频在线| 亚洲日韩在线视频| 亚洲av成人无码久久精品| 亚洲精品老司机在线观看| 性生交片免费无码看人| 99热在线免费观看| 免费av片在线观看网站| 精品久久久久久无码免费| 高潮内射免费看片| 成人精品国产亚洲欧洲| 亚洲暴爽av人人爽日日碰| 亚洲AV日韩综合一区尤物| 亚洲成AV人综合在线观看| 亚洲黄色在线视频| 亚洲综合日韩中文字幕v在线| 国产亚洲A∨片在线观看| 亚洲综合日韩久久成人AV| 亚洲精品国产综合久久一线| 亚洲精品第一国产综合境外资源| 日本人的色道www免费一区| 性xxxx视频播放免费| 在线观看成人免费视频| 欧美好看的免费电影在线观看| 麻豆国产精品免费视频| 免费观看美女用震蛋喷水的视频| 国产成人精品免费视频大全麻豆| 精品免费久久久久久久| 国产精品色拉拉免费看| 18勿入网站免费永久| 野花高清在线观看免费完整版中文 | 亚洲av日韩av永久在线观看| 亚洲高清毛片一区二区| 美女扒开屁股让男人桶爽免费| 国产精品亚洲一区二区三区|