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

  • 相关阅读:
    QT启动画面不显示
    指针运算,终于明白了
    sourceforge 优秀 开源 项目 介绍
    ios验证邮箱格式
    获取手机当前经纬度的方法
    将UIImageView改成圆角和圆形
    Extensible Messaging and Presence Protocol (XMPP) 的实现
    导入libxml2.dylib时出问题
    Extensible Messaging and Presence Protocol (XMPP) 简介
    XMPPFramework 常用api包简介
  • 原文地址:https://www.cnblogs.com/hehe520/p/6330589.html
Copyright © 2011-2022 走看看