有时分区表的分区进行了数据交换,导致分区索引变为不可用,这时需要我们对此进行重建。
对此,我们需要进行如下操作:
1、如果有很多分区字段,需要生成一个脚本来做
select 'ALTER INDEX gps.' || INDEX_NAME || ' REBUILD PARTITION ' || PARTITION_NAME || ' ;' from dba_ind_partitions where index_owner='GPS' AND status='UNUSABLE' ORDER BY 1;
2、执行重建索引的语句
ALTER INDEX gps.LCDX_SIGN_TIME_CARD REBUILD PARTITION P120625 ; ALTER INDEX gps.LCDX_SIGN_TIME_CARD REBUILD PARTITION P120626 ; ALTER INDEX gps.LCDX_SIGN_TIME_CARD REBUILD PARTITION P120627 ; ALTER INDEX gps.LCDX_SIGN_TIME_CARD REBUILD PARTITION P120628 ; ALTER INDEX gps.LCDX_SIGN_TIME_CARD REBUILD PARTITION P120629 ; ALTER INDEX gps.LCDX_SIGN_TIME_CARD REBUILD PARTITION P120630 ; ALTER INDEX gps.LCDX_SIGN_TIME_CARD REBUILD PARTITION P120701 ; ALTER INDEX gps.LCDX_STAT_TIME_CARD REBUILD PARTITION P120625 ; ALTER INDEX gps.LCDX_STAT_TIME_CARD REBUILD PARTITION P120626 ; ALTER INDEX gps.LCDX_STAT_TIME_CARD REBUILD PARTITION P120627 ; ALTER INDEX gps.LCDX_STAT_TIME_CARD REBUILD PARTITION P120628 ; ALTER INDEX gps.LCDX_STAT_TIME_CARD REBUILD PARTITION P120629 ; ALTER INDEX gps.LCDX_STAT_TIME_CARD REBUILD PARTITION P120630 ; ALTER INDEX gps.LCDX_STAT_TIME_CARD REBUILD PARTITION P120701 ; |