Solved

index or partition of such index is in unusable state

Posted on 2009-07-14
10
1,686 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
  • 4
  • 3
  • 3
10 Comments
 
LVL 31

Expert Comment

by:awking00
Comment Utility
Can you post the complete error message?
0
 
LVL 47

Expert Comment

by:schwertner
Comment Utility
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
Comment Utility
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
 
LVL 47

Expert Comment

by:schwertner
Comment Utility
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 31

Expert Comment

by:awking00
Comment Utility
Run the attached query.
query.txt
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:pkunwor
Comment Utility
I get status as 'UNUSABLE '
0
 
LVL 47

Expert Comment

by:schwertner
Comment Utility
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 31

Expert Comment

by:awking00
Comment Utility
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
Comment Utility
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 47

Assisted Solution

by:schwertner
schwertner earned 20 total points
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now