lundi 28 septembre 2015

Reconstruction des index

Le problème :
ORA-01502: index 'idx_bd' or partition of such index is in unusable state 


lister les indexes invalides :

SELECT owner, index_name, tablespace_name
FROM   dba_indexes
WHERE  status = 'UNUSABLE';

On peut aussi voir les indexes de partitions :

SELECT index_owner, index_name, partition_name, tablespace_name
FROM   dba_ind_PARTITIONS
WHERE  status = 'UNUSABLE';

Générer le scripts pour reconstruire les indexes :

SELECT 'alter index '||owner||'.'||index_name||' rebuild tablespace '||tablespace_name ||';'
FROM   dba_indexes
WHERE  status = 'UNUSABLE';


Générer le scripts pour reconstruire les indexes de partition :

SELECT 'alter index '||owner||'.'||index_name ||' rebuild partition '||PARTITION_NAME||' TABLESPACE '||tablespace_name ||';'
FROM   dba_ind_partitions
WHERE  status = 'UNUSABLE';


alter index MON_IDX  rebuild tablespace INDX;

Aucun commentaire:

Enregistrer un commentaire