Solved

index or partition of such index is in unusable state

Posted on 2009-07-14
10
1,745 Views
Last Modified: 2012-05-07
I am getting ORA 01502 index or partition of such index is in unusable state when trying to insert in table 2 after exchange partition. The exchange parttion itself is working fine.

ALTER TABLE  table1 EXCHANGE PARTITION pcurrent
with table table2

Any suggestions?

Thanks.

0
Comment
Question by:pkunwor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
10 Comments
 
LVL 32

Expert Comment

by:awking00
ID: 24849423
Can you post the complete error message?
0
 
LVL 48

Expert Comment

by:schwertner
ID: 24849447
Oracle's partitioning capabilities have been enhanced in Oracle9i with the addition of a feature that enables global indexes to be maintained during partition maintenance operations. A new clause, UPDATE GLOBAL INDEXES, can optionally be appended to the maintenance commands. When this clause is present, Oracle will automatically and efficiently maintain all global indexes instead of making them UNUSABLE. For example, when dropping a partition, the command to take advantage of this new feature is: ALTER TABLE T1 DROP PARTITION P1 UPDATE GLOBAL INDEXES;
Availability - When an index in marked UNUSABLE, applications may become unusable since they depend on indexes to guarantee performance. When using the UPDATE GLOBAL INDEXES clause, global indexes are always available. Hence there is no impact on applications that might be accessing the table.

0
 

Author Comment

by:pkunwor
ID: 24849971
I tried adding UPDATE GLOBAL INDEXES to above EXCHANGE PARTITION SYNTAX but still getting same error.

The complete error message is as follows

ORA-01502:index 'index_name' or partition of such index in unusable state.  (index_name is the name of index in my table)

0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 48

Expert Comment

by:schwertner
ID: 24850096
Then rebuild the index.

SELECT * from USER_INDEXES WHERE STATUS = INVALID

alter index  index_nsme rebuild;

This could be combined in PL/SQL procedure
0
 
LVL 32

Expert Comment

by:awking00
ID: 24850433
Run the attached query.
query.txt
0
 

Author Comment

by:pkunwor
ID: 24852541
I get status as 'UNUSABLE '
0
 
LVL 48

Expert Comment

by:schwertner
ID: 24852651
What is expected and marked at the beqinning of the question.
This is so, because the underlzing table expirienced major changes
that made the index unusable.
The resolution is to rebuild the index.
0
 
LVL 32

Expert Comment

by:awking00
ID: 24853081
Have you tried running the alter index index_name rebuild statement that schwertner has shown and re-run your exchange partition statement?
0
 

Accepted Solution

by:
pkunwor earned 0 total points
ID: 24860226
Rebuilding the index solved the problem temporarily. The issue occurs every time exchange partition is run and i have to rebuild the index again. since exchange partition is part of regular process, i was trying to avoid rebuilding index every time.

anyway, I found that this error is unaviodable with exchange partition when global index is used. I had to change the indexes to be local that resolved the issue. Thanks all for your suggestions.
0
 
LVL 48

Assisted Solution

by:schwertner
schwertner earned 20 total points
ID: 24861372
Exchange partition is a major change of the tables and changes drasticallz the conntents of the table. So it is expected that the indexes will get corrupted.
One workaround is to write procedure thar will do the two thingsÖ EXCHANGE PARTITION and REBUILD. So you will not have troubles.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question