How Do Indexes Become Unusable? (Doc ID 1054736.6)

How Do Indexes Become Unusable? (Doc ID 1054736.6)

Description of which operations mark index partitions as INDEX UNUSABLE.

CAUSE

There are six types of maintenance operations and adding a partition to a Hash-Partitioned Table that mark index partitions INDEX UNUSABLE (IU). In all cases, you must rebuild the index partitions when the operation is complete.

SOLUTION

NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product. Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

Maintenance operations causing index partitions to become INDEX UNUSABLE (IU):

  1. IMPORT PARTITION or conventional path SQL*Loader.

  2. Direct-path SQL*Loader leaves affected local index partitions and global indexes in an IU state if it does not complete successfully.

  3. Partition maintenance operations like ALTER TABLE MOVE PARTITION.

  4. Partition maintenance operations like ALTER TABLE TRUNCATE PARTITION.

  5. Partition maintenance operations like ALTER TABLE SPLIT PARTITION.

  6. Index maintenance operations like ALTER INDEX SPLIT PARTITION.

  7. Adding a Partition to a Hash-Partitioned Table

Adding a Partition to a Hash-Partitioned Table

When you add a partition to a hash-partitioned table, the database populates the new partition with rows rehashed from an existing partition (selected by the database) as determined by the hash function. Consequently, if the table contains data, then it may take some time to add a hash partition.

The following statements show two ways of adding a hash partition to table <Table_Name>. Choosing the first statement adds a new hash partition whose partition name is system generated, and which is placed in the default tablespace. The second statement also adds a new hash partition, but that partition is explicitly named <Partition_Name> and is created in tablespace <Tablespace_Name>.

ALTER TABLE <Table_Name> ADD PARTITION;

ALTER TABLE <Table_Name> ADD PARTITION <Partition_Name> TABLESPACE <Tablespace_Name>;

Indexes may be marked UNUSABLE as explained in the following table:

Table Type Index Behavior

Regular (Heap) Unless you specify UPDATE INDEXES as part of the ALTER TABLE statement:

The local indexes for the new partition, and for the existing partition from which rows were redistributed, are marked UNUSABLE and must be rebuilt.

All global indexes, or all partitions of partitioned global indexes, are marked UNUSABLE and must be rebuilt.

Index-organized For local indexes, the behavior is identical to heap tables.

All global indexes remain usable.

Each of these operations may cause index partitions to be marked IU which will require the index partitions to be rebuilt.

Version 10.2 and later

By default, many table maintenance operations on partitioned tables invalidate (mark UNUSABLE) the corresponding indexes or index partitions. You must then rebuild the entire index or, in the case of a global index, each of its partitions. The database lets you override this default behavior if you specify UPDATE INDEXES in your ALTER TABLE statement for the maintenance operation. Specifying this clause tells the database to update the index at the time it executes the maintenance operation DDL statement.

The following operations support the UPDATE INDEXES clause:

* ADD PARTITION | SUBPARTITION

* COALESCE PARTITION | SUBPARTITION

* DROP PARTITION | SUBPARTITION

* EXCHANGE PARTITION | SUBPARTITION

* MERGE PARTITION | SUBPARTITION

* MOVE PARTITION | SUBPARTITION

* SPLIT PARTITION | SUBPARTITION

* TRUNCATE PARTITION | SUBPARTITION

Note:12c has come up with Optimized Global index maintenance during drop or truncate partition.Please refer the below note for more details:

12c Partitioning Enhancements, New Features (Doc ID 1568010.1)

REFERENCES

Database Administrator's Guide 10g Release 2 (10.2)

相关推荐
小黑屋的黑小子3 小时前
【MySQL】MySQL索引与事务
数据库·mysql·oracle
程序员不想YY啊9 小时前
MySQL元数据库完全指南:探秘数据背后的数据
数据库·mysql·oracle
博睿谷IT99_10 小时前
数据库证书可以选OCP认证吗?
数据库·oracle·开闭原则·ocp认证
浩浩测试一下14 小时前
SQL注入高级绕过手法汇总 重点
数据库·sql·安全·web安全·网络安全·oracle·安全架构
听闻风很好吃18 小时前
DAY9:Oracle数据库安全管理深度解析
oracle
m0_748232921 天前
你还在手动画ER图吗?让SQL自动生成ER图,轻松解决作业难题!
数据库·sql·oracle
代码小侦探1 天前
Java中以Maven方式引入Oracle JDBC Driver依赖的详解
java·oracle·maven
DarkAthena1 天前
【ORACLE】记录一些ORACLE的merge into语句的BUG
数据库·oracle·bug
江沉晚呤时1 天前
深入了解C# List集合及两种常见排序算法:插入排序与堆排序
windows·sql·算法·oracle·c#·排序算法·mybatis
_extraordinary_1 天前
MySQL 库的操作 -- 增删改查,备份和恢复,系统编码
android·mysql·oracle