• 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

  • 相关阅读:
    网络IO之阻塞、非阻塞、同步、异步总结
    C语言栈与调用惯例
    多个文件目录下Makefile的写法
    利用 mount 指令解决 Read-only file system的问题
    error while loading shared libraries: xxx.so.x" 错误的原因和解决办法
    Centos6.4下安装protobuf及简单使用
    Centos下修改启动项和网络配置
    Centos下配置单元测试工具gtest
    Centos配置为驱动程序开发环境
    Centos安装gcc及g++
  • 原文地址:https://www.cnblogs.com/hehe520/p/6330589.html
Copyright © 2020-2023  润新知