This procedure assumes you had this error (corrupted block in index partition):
ORA-01578: ORACLE data block corrupted (file # 459, block # 15)
ORA-01110: data file 459: '/path/to/datafile.dbf'
ORA-26040: Data block was loaded using the NOLOGGING option
1. Find out which partition has corrupted block
select distinct partition_name, index_name
from dba_ind_subpartitions
where subpartition_name in
(
select partition_name
from dba_segments
where tablespace_name in
(
select tablespace_name
from dba_data_files
where file_name = '/path/to/datafile.dbf'
)
)
/
2. Mark the index partition unusable
SQLPLUS> ALTER INDEX schema_name.index_name MODIFY PARTITION partition_name UNUSABLE;
3. Re-build index partition
If it's not a composite range partition you can simply do the following:
SQLPLUS> ALTER INDEX schema_name.index_name REBUILD PARTITION partition_name;
Otherwise, if it is a composite range partition you will get the following error:
ORA-14287: cannot REBUILD a partition of a Composite Range partitioned index
What you have to do is to rebuild each subpartition at a time. Here's the SQL script for
rebuilding subpartitions:
set head off pagesize 0 linesize 100
select 'ALTER INDEX ' || index_owner || '.' || index_name || ' REBUILD SUBPARTITION ' ||
subpartition_name || ';'
from dba_ind_subpartitions
where subpartition_name in
(
select partition_name
from dba_segments
where tablespace_name in
(
select tablespace_name
from dba_data_files
where file_name = '/path/to/datafile.dbf'
)
)
/
Copy and paste the commands to sqlplus or spool it to file if there are many subpartitions.
|