ORA-14086: a partitioned index may not be rebuilt as a whole
Local and global indexes are present in the partition table of the oracle. The index is created on basis of partition is local and the index created on the whole table is a global index. You cannot rebuild the local index which has partition as normal. If you tried to do you are getting the following error:
SQL> alter index sales_IDX rebuild;
alter index sales_IDX rebuild
*
ERROR at line 1:
ORA-14086: a partitioned index may not be rebuilt as a whole
Rebuild partition index by specifying partition name.
ALTER INDEX sales_IDX REBUILD PARTITION sales_Q4 TABLESPACE users;
Rebuild the Global index as normal
ALTER INDEX sales_ids REBUILD;
Check the index is local or global:
select INDEX_NAME,TABLE_NAME,INDEX_type ,GLOBAL_STATS from dba_indexes where table_name = 'EMP';
Check the partition index
select index_name, partition_name,status from dba_ind_partitions;
Rebuild the partition local index with the script
-- Offline rebuild
SET LINESIZE 5000;
SET PAGESIZE 5000;
SET LONG 50000;
SET TRIMSPOOL ON
SET WRAP ON
set termout off
set verify off
set longchunksize 200000
set feedback off
SET HEADING Off
set echo off
Select 'ALTER INDEX '|| index_name ||' rebuild partition ' || PARTITION_NAME ||';' from dba_IND_PARTITIONS where INDEX_OWNER='HR';
-- Online rebuild
SET LINESIZE 5000;
SET PAGESIZE 5000;
SET LONG 50000;
SET TRIMSPOOL ON
SET WRAP ON
set termout off
set verify off
set longchunksize 200000
set feedback off
SET HEADING Off
set echo off
Select 'ALTER INDEX '|| index_name ||' rebuild partition ' || PARTITION_NAME ||' online ;' from dba_IND_PARTITIONS where INDEX_OWNER='HR';
nice article.. thanks for the help..
– Satya
http://satya-dba.blogspot.com/
LikeLike