Put your tips and tricks online - Share your knowledge! Login | Register
 
 
  Search     Advanced search
 

Home | Ask Question | Add tip | My tips | Recent tips & tricks | Suggest a category | FAQ | Forums

 
 
 
 Category : Home > Databases > Oracle > Block Corruption     

Rebuilding index partitions / subpartitions with corrupted block


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.


  Options
 
   del.icio.us  |  newsvine  |  digg  |  furl  |  google  |  yahoo  |  Ma.gnolia  |  vigillar  |  reddit  |  technorati  |  icerocket  |  pubsub

     (Average: 4.86 / Votes: 7)   Rate this tip:    

Start discussion or add comment to this tip

  Details
Tip reference : #54
views : 19376
Added on : 11/17/05
Submited by : h8dk97
 
Send a message Send a message Printer friendly output Printer friendly output
Display this member's tips Display this member's tips (202)
 
 
<< Previous Next >>
 Most viewed tips 
  Databases > Oracle > Security : How to unlock Oracle user account  
  Databases > Oracle > Performance Tuning : How to enable trace in Oracle  
  Operating Systems > Unix : How to kill Unix user session  
  Databases > Oracle : Kill user session  
   
  All categories
Databases | Programming | Hardware | Operating Systems | Networking | Internet | ERP / CRM | Games & Multimedia | Graphics & Design | Miscellaneous | Mobile Phones / Tablets | Office Software
 
 

Home |  FAQ |  Terms of Use |  Privacy Policy

© 2005 tiplib.com