Home » SQL & PL/SQL » SQL & PL/SQL » index 'index-name' or partition of such index is in unusable state (Oracle 11gr2,Linux)
index 'index-name' or partition of such index is in unusable state [message #550548] Tue, 10 April 2012 05:39 Go to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
Hi,
We are getting the below error frequently from the application while doing insertion/dataloading to a table. The mentioned error is in the Primary key index

Error
-----
'ORA-01502: index 'INDEX_NAME' or partition of such index is in unusable state'.

I set the value SKIP_UNUSABLE_INDEXES = TRUE using the command 'ALTER SYSTEM SET SKIP_UNUSABLE_INDEXES = TRUE' to avoid this. Again we are getting the same error and Every time Iam rebuilding('alter index INDEX_NAME rebuild') the index and doing the DML Operation. Can you please provide a permenant solution for this ?

Regards,
Prejib
Re: index 'index-name' or partition of such index is in unusable state [message #550549 is a reply to message #550548] Tue, 10 April 2012 05:41 Go to previous messageGo to next message
cookiemonster
Messages: 13967
Registered: September 2008
Location: Rainy Manchester
Senior Member
How are you loading data?
Re: index 'index-name' or partition of such index is in unusable state [message #550551 is a reply to message #550549] Tue, 10 April 2012 05:43 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
Using the application itself some kind of publishing not from the back-end.
Re: index 'index-name' or partition of such index is in unusable state [message #550552 is a reply to message #550551] Tue, 10 April 2012 05:45 Go to previous messageGo to next message
cookiemonster
Messages: 13967
Registered: September 2008
Location: Rainy Manchester
Senior Member
Well I assume that's what is breaking the indexes, so more details are required.
Re: index 'index-name' or partition of such index is in unusable state [message #550554 is a reply to message #550552] Tue, 10 April 2012 06:05 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
Hi,
In the oracle Enterprise manager , I can see 2 reccomendation for the same table to reclaim the space as given in the attachment and I have executed the below statement to compress the space .

alter table "TABLE_NAME" compress for oltp;
alter table "TABLE_NAME" move;

Please let me know what are the other details you want ?

Regards,
Prejib
Re: index 'index-name' or partition of such index is in unusable state [message #550556 is a reply to message #550554] Tue, 10 April 2012 06:14 Go to previous messageGo to next message
John Watson
Messages: 8988
Registered: January 2010
Location: Global Village
Senior Member
The MOVE will have broken all the indexes. This is expected behaviour.
By the way, I think you may need to buy the advanced compression option befire using OLTP compression
Re: index 'index-name' or partition of such index is in unusable state [message #550563 is a reply to message #550556] Tue, 10 April 2012 07:22 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
can you please provide me the DDL for the above suggested?
Re: index 'index-name' or partition of such index is in unusable state [message #550564 is a reply to message #550563] Tue, 10 April 2012 07:24 Go to previous messageGo to next message
John Watson
Messages: 8988
Registered: January 2010
Location: Global Village
Senior Member
You don't buy the advanced compression option with DDL, you buy it with money.
Re: index 'index-name' or partition of such index is in unusable state [message #550567 is a reply to message #550564] Tue, 10 April 2012 07:29 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
we are not in a situation to buy the same since its small development DB. can you suggest some other effective way for this ?
Re: index 'index-name' or partition of such index is in unusable state [message #550570 is a reply to message #550567] Tue, 10 April 2012 07:45 Go to previous messageGo to next message
John Watson
Messages: 8988
Registered: January 2010
Location: Global Village
Senior Member
If you don't buy the licence, you can't use OLTP compression. But why do you want to use it? It seems that that you have deliberately broken all your indexes by compressing and moving the tables, because Enterprise Manager said it would save you a few MB. Just leave things as they were. And you will have to alter the the table NOCOMPRESS to bring your database back into licence compliance.
Re: index 'index-name' or partition of such index is in unusable state [message #551397 is a reply to message #550570] Tue, 17 April 2012 23:33 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
I have alter the table with nocompress option , still getting the same error . Also I have recreated the unique index(primary key).
Re: index 'index-name' or partition of such index is in unusable state [message #551454 is a reply to message #551397] Wed, 18 April 2012 08:13 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
prejib wrote on Wed, 18 April 2012 00:33
I have alter the table with nocompress option , still getting the same error

This was just to put the database in license compliance.

You're not showing us any queries to prove that you have any errors. All you are telling us is that you have an error. Show us the commands you ran that built the index and ALL output. I will only ask once.
Re: index 'index-name' or partition of such index is in unusable state [message #551532 is a reply to message #551454] Thu, 19 April 2012 01:09 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
The below given is the error getting from application.
Caused by: java.sql.SQLException: ORA-01502: index 'INDEX_NAME' or partition of such index is in unusable state

       at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
       at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
       at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:213)
       at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:952)
       at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160)



I always execute the o/p of the below query to rebuild the index.

SQL> select 'alter index '||owner||'.'||index_name||' rebuild;' from dba_indexes where STATUS = 'UNUSABLE';


Re: index 'index-name' or partition of such index is in unusable state [message #551533 is a reply to message #551532] Thu, 19 April 2012 01:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68767
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
But if this is a partitioned index you do not rebuild the unusable partitions then.

Regards
Michel
Re: index 'index-name' or partition of such index is in unusable state [message #551534 is a reply to message #551533] Thu, 19 April 2012 01:34 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
This is not a partioned index. The table is also not a partitioned one. I hve dropped the index and recreated also . Still getting the same error
Re: index 'index-name' or partition of such index is in unusable state [message #551535 is a reply to message #551534] Thu, 19 April 2012 01:42 Go to previous messageGo to next message
John Watson
Messages: 8988
Registered: January 2010
Location: Global Village
Senior Member
Prejib, it is hard to assist because you NEVER give complete information. We need to know the sequence of events that results in the index going bad. Show the complete sequence, like this:
orcl> conn scott/tiger
Connected.

Session altered.

orcl> select index_name,status from user_indexes where status <> 'VALID';

no rows selected

orcl> alter table emp move;

Table altered.

orcl> select index_name,status from user_indexes where status <> 'VALID';

INDEX_NAME                     STATUS
------------------------------ --------
PK_EMP                         UNUSABLE

orcl> alter index pk_emp rebuild;

Index altered.

orcl> select index_name,status from user_indexes where status <> 'VALID';

no rows selected

orcl>
Re: index 'index-name' or partition of such index is in unusable state [message #551538 is a reply to message #551535] Thu, 19 April 2012 02:02 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
I have changed the exact schema_name and table_name
SQL> show parameter skip;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
skip_unusable_indexes                boolean     TRUE

SQL> select index_name,status from dba_indexes where status = 'UNUSABLE';

no rows selected

SQL> alter table "schema_name"."table_name" compress for oltp;

Table altered.

SQL> select index_name,status from dba_indexes where status = 'UNUSABLE';

no rows selected

SQL> alter table "schema_name"."table_name" move;

Table altered.

SQL> select index_name,status from dba_indexes where status = 'UNUSABLE';

INDEX_NAME                     STATUS
------------------------------ --------
TABLE_NAME_P			UNUSABLE

SQL> select 'alter index '||owner||'.'||index_name||' rebuild;' from dba_indexes where STATUS = 'UNUSABLE';

'ALTERINDEX'||OWNER||'.'||INDEX_NAME||'REBUILD;'
--------------------------------------------------------------------------------
alter index schema_name.table_name rebuild;

SQL> alter index schema_name.table_name rebuild;

Index altered.

SQL>  select 'alter index '||owner||'.'||index_name||' rebuild;' from dba_indexes where STATUS = 'UNUSABLE';

no rows selected

SQL> alter table PHILIP_PUB.PH_PRODUCT_FILTER_ATTRIBUTES nocompress;

Table altered.

Re: index 'index-name' or partition of such index is in unusable state [message #551540 is a reply to message #551538] Thu, 19 April 2012 02:23 Go to previous messageGo to next message
John Watson
Messages: 8988
Registered: January 2010
Location: Global Village
Senior Member
So moving a table breaks the indexes. This is expected behaviour. I told you that a week ago. What's the problem?

[Updated on: Thu, 19 April 2012 02:24]

Report message to a moderator

Re: index 'index-name' or partition of such index is in unusable state [message #551543 is a reply to message #551540] Thu, 19 April 2012 03:48 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
Now we are getting the same error frequently (daily 2-3 times ). Please Suggest a solution for this .
Re: index 'index-name' or partition of such index is in unusable state [message #551553 is a reply to message #551543] Thu, 19 April 2012 04:37 Go to previous messageGo to next message
cookiemonster
Messages: 13967
Registered: September 2008
Location: Rainy Manchester
Senior Member
Stop moving the tables?
Re: index 'index-name' or partition of such index is in unusable state [message #551554 is a reply to message #551553] Thu, 19 April 2012 04:56 Go to previous messageGo to next message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
Nowadays I am not doing so
Re: index 'index-name' or partition of such index is in unusable state [message #551555 is a reply to message #551543] Thu, 19 April 2012 04:58 Go to previous messageGo to next message
John Watson
Messages: 8988
Registered: January 2010
Location: Global Village
Senior Member
A week ago, Cookie told you to investigate the technique used for loading data. It is probably something like sqlldr with the skip_index_maintenance clause, which would cause this. But since you haven't provided any information, I really don't know.

And btw, I notice that you have never said "thank you for your time". Not even once. Well, I've no more time for this. Perhaps someone else has.


Re: index 'index-name' or partition of such index is in unusable state [message #551558 is a reply to message #551555] Thu, 19 April 2012 05:39 Go to previous message
prejib
Messages: 126
Registered: March 2009
Location: India
Senior Member
Thanks for your suggetions && valuable time!!!!

This is happening when data has been inserted from the front end not the bulk loading
Previous Topic: POPULAR OCCURANCE / DRAW / RECENCY (FROM 2 Tables)
Next Topic: creating a procedure which will process all the cursors (merged)
Goto Forum:
  


Current Time: Fri Aug 22 23:46:25 CDT 2025