When a configuration tool is used, the following errors often occur ora-01502: index ‘xxx. Xxxxx’ or partition of such index is in an unusable state. The solution is to log in as DBA and run the following script
-- Please login with DBA privileges and execute
-- Repair all the indexes in UNUSABLE state, rebuild them
declare
-- cursor to all UNUSABLE state indexes
cursor c is
select index_name, owner
from dba_indexes
where status='UNUSABLE';
owner dba_indexes.owner%type;
index_name dba_indexes.index_name%type;
begin
open c;
loop
fetch c into index_name, owner;
exit when c%notfound;
execute immediate 'alter index ' || owner || '.' || index_name || ' rebuild';
end loop;
close c;
end;
Thinking 1: why does normal operation cause an index to be unusable
Thinking 2: how to solve this problem without logging into DBA( I tried it from user_ In the indexes table, you can get all the indexes of the current user, but you can’t edit them.)
Similar Posts:
- [Solved] Record an error of expdp export ora-01555 caused by lob damage
- [Solved] SQL Server Error: Cannot drop database XXX because it is currently in use
- [Solved] Elasticsearch Error: “java.lang.IllegalArgumentException: Rejecting mapping update to [xxx] as the final mapping would have more than 1 type: [_doc, log]””
- [How to Solve Eclipse Issue] Open type (Ctrl-Shift-T) Can Not Found
- ERROR: Functions in index expression must be marked IMMUTABLE
- Solution to the error of ora-06550 pls-00103 when Django connects Oracle to run PLSQL statement
- Solve Python MySQL insert int data error: typeerror% d format: a number is required, not str
- The database could not be exclusively locked to perform the operation (SQL Server 5030 error solution)
- ORA-02292: integrity constraint
- Postgres invalid command data recovery processing