SELECT 'alter index '||t2.owner||'.'||t1.INDEX_NAME||' rebuild partition '||t1.PARTITION_NAME||' online;',
t1.STATUS
FROM dba_ind_partitions t1, dba_indexes t2
where t1.index_name = t2.index_name
AND t1.STATUS = 'UNUSABLE' ;
SELECT 'alter index '||t1.index_owner||'.'||t1.INDEX_NAME||' rebuild partition '||t1.PARTITION_NAME||' online;',
t1.STATUS
FROM dba_ind_partitions t1
where t1.STATUS = 'UNUSABLE' ;