有配置工具使用时, 经常会出现以下错误: ORA-01502: index 'xxx.xxxxx' or partition of such index is in unusable state,解决方法为——以 DBA 登录,并运行以下脚本即可
- --请以DBA权限登录,并执行
- --将所有UNUSABLE状态的index修复,rebuild一下即可
- declare
- --指向所有UNUSABLE状态的index的游标
- cursorcis
- selectindex_name,owner
- fromdba_indexes
- wherestatus='UNUSABLE';
- ownerdba_indexes.owner%type;
- index_namedba_indexes.index_name%type;
- begin
- openc;
- loop
- fetchcintoindex_name,owner;
- exitwhenc%notfound;
- executeimmediate'alterindex'||owner||'.'||index_name||'rebuild';
- endloop;
- closec;
- end;