You are on page 1of 1

################################################################################

# Following Script generates statements to move tables to particular tablespace.


select 'ALTER TABLE '||owner||'.'||table_name||' MOVE TABLESPACE HR_DATA;'
from dba_tables
where OWNER='HR'
Sample:
ALTER TABLE HR.ALPHABET_SYN MOVE TABLESPACE HR_DATA;
OR
select 'ALTER TABLE '||owner||'.'||table_name||' MOVE;'
from dba_tables
where OWNER='HR'
Sample:
ALTER TABLE HR.ALPHABET_SYN MOVE;
################################################################################
######
# Following Script generates statements to rebuild indexes on a particular table
space.
select 'ALTER INDEX '||owner||'.'||index_name||' REBUILD TABLESPACE HR_INDX;'
from dba_indexes
where OWNER='HR'
Sample:
ALTER INDEX HR.CLK_PROF_CAT_PK REBUILD TABLESPACE HR_INDX;
OR
select 'ALTER INDEX '||owner||'.'||index_name||' REBUILD;'
from dba_indexes
where OWNER='HR'
Sample:
ALTER INDEX HR.CLK_PROF_CAT_PK REBUILD;
################################################################################
# Following Script generates statements to analyze table and compute statistics.
select 'ANALYZE TABLE '||owner||'.'||table_name||' COMPUTE STATISTICS;'
from dba_tables
where OWNER='HR'
Sample
ANALYZE TABLE HR.CLK_ADDRESS_TYPES COMPUTE STATISTICS;

You might also like