select 'ALTER INDEX '||t1.OWNER||'.'||t1.INDEX_NAME||' REBUILD ONLINE; ' COMAND0_REBUILD_DDL,
       --'ALTER INDEX '||t1.OWNER||'.'||t1.INDEX_NAME||' REBUILD ONLINE TABLESPACE TI_DBSNGPC NOLOGGING; ' COMAND0_REBUILD_DDL,
       --'ALTER INDEX '||t1.OWNER||'.'||t1.INDEX_NAME||' REBUILD ONLINE INITRANS 50 TABLESPACE TI_DBSVS NOLOGGING; ' COMAND0_REBUILD_DDL,
       --'ALTER INDEX '||t1.OWNER||'.'||t1.INDEX_NAME||' REBUILD ONLINE NOLOGGING; ' COMAND0_REBUILD_DDL,
       --'ALTER INDEX '||t1.OWNER||'.'||t1.INDEX_NAME||' LOGGING; ' COMAND0_REBUILD_DDL,       
       t1.OWNER, t1.table_name, t1.INDEX_NAME, t1.tablespace_name, t1.index_type, t1.last_analyzed
       --(,SELECT a.last_ddl_time from dba_objects a where a.object_name = t1.index_name and a.owner = t1.owner) last_ddl_time 
from   dba_indexes t1
where  t1.owner = 'DBSVS' 
and t1.table_name in ('TB_SITUACAO_PRODUTO')
and t1.index_type <> 'LOB' 
--and t1.tablespace_name <> 'TI_DBSVS'
--order by last_ddl_time 

--Indices particionados
select * from dba_part_indexes b where b.owner =  'DBSVS' and  b.table_name in ('TB_TRAMITACAO_DOCUMENTO')
select * from dba_part_tables c where c.owner =  'DBSVS' and c.table_name  in ('TB_TRAMITACAO_DOCUMENTO')

SELECT 'ALTER INDEX DBSVS.IN_DOCUMENTO_COTIPODOCUMENTO REBUILD PARTITION '||d.partition_name||' ONLINE; '
FROM DBA_TAB_PARTITIONS D WHERE d.table_owner =  'DBSVS' and  d.table_name in ('TB_DOCUMENTO')

hostgator