zoukankan      html  css  js  c++  java
  • rebuild 分区索引

    今天要做一个任务,rebuild 一个索引, 该索引建立在有11亿条数据的表上。

    对于非组合分区索引,需要rebuild 每个分区(partition),不能直接rebuild整个索引,

    对于组合分区索引,需要rebuild每个子分区(subpartition),不能直接rebuild整个索引,也不能直接rebuild 分区(partition)

    由于我要rebuild的索引很大,有100多个分区,928个子分区,因此利用手工写rebuild命令显然不合适(要写928个命令 哭。。。),下面整理一下脚本供以后利用。

    由于我这里是仓库环境,所以我没有写rebuild online.另外请注意,sunpartition 的索引 rebuild 的时候不能 设置 nologging, pctfree ...等storage条件。只能设置 tablespace ...parallel 否则 报错如下:

    ORA-14189: this physical attribute may not be specified for an index subpartition

    非组合分区索引

    SET ECHO OFF
    set termout off 
    set feedback off
    set heading off
    set linesize 200
    set pagesize 10000

    spool c:/partition.sql

    select 'alter index ' || index_owner || '.' ||index_name ||' rebuild partition ' || PARTITION_NAME || ' nologging parallel ;'
    from dba_ind_partitions where index_owner='&index_owner' and index_name=&index_name;

    spool off

    对于组合分区索引


    SET ECHO OFF
    set termout off 
    set feedback off
    set heading off
    set linesize 200
    set pagesize 10000

    spool c:/subpartition.sql
    select 'alter index ' || index_owner || '.' ||index_name ||' rebuild subpartition ' || subpartition_name || '  parallel ;'
    from dba_ind_subpartitions where index_owner='&index_owner' and index_name='&index_name';
    spool off

  • 相关阅读:
    机器学习: t-Stochastic Neighbor Embedding 降维算法 (二)
    数学辨异 —— 泰勒展开与等比数列求和
    HDU 4705 Y
    C#实现的内存分页机制的一个实例
    java程序获得SqlServer数据表的表结构
    GLSL中的各种变量总结
    HTTP协议学习
    Jedis中的一致性hash
    C语言数据结构----双向链表
    ios7毛玻璃效果实现
  • 原文地址:https://www.cnblogs.com/hehe520/p/6330589.html
Copyright © 2011-2022 走看看