Move all table or index to a new / different tablespace while it is online
select 'alter index '||owner||'.'||index_name||' rebuild tablespace TBS_INDEX ONLINE;' from all_indexes where owner='SABUJ'; select 'ALTER TABLE '||owner||'.'||TABLE_NAME||' MOVE ONLINE tablespace TBS_DATA ;' from all_tables where owner='SABUJ'; SELECT 'ANALYZE TABLE '||owner||'.' || table_name || ' COMPUTE STATISTICS;' FROM all_tables WHERE owner in ('SABUJ','HRMS') ORDER BY 1; select 'analyze index '||owner||'.'||index_name||' validate structure;' from dba_indexes where owner in ('SABUJ','HRMS')