Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> TIP: The most easy way to move tables between schemas/tablespaces
Recently I have encounter such problems and search the net for best
answers, now here is the summary of the way I choose, it may be helps
to you.
NOTICE:
The method described above works for LOBs, but partitions information
seems to be lost. Will anyone help me to complete a full guideline for
this topic.
Attachment script: (Originally by an oracle expert from oracle corp. thanks him!)
set echo off
column order_col1 noprint
column order_col2 noprint
set heading off
set verify off
set feedback off
set echo off
spool h:\temp\tmp.sql
select decode( segment_type, 'TABLE', segment_name, table_name ) order_col1,
decode( segment_type, 'TABLE', 1, 2 ) order_col2, 'alter ' || segment_type || ' ' || segment_name || decode( segment_type, 'TABLE', ' move ', ' rebuild ' ) || chr(10) || decode( segment_type, 'TABLE', ' tablespace &1 ', ' tablespace &2 ' ) || chr(10) ||next_extent ||
' storage ( initial ' || initial_extent || ' next ' ||
' minextents ' || min_extents || ' maxextents ' || max_extents
|| chr(10)
||
' pctincrease ' || pct_increase || ' freelists ' || freelists ||
');'
from user_segments, (select table_name, index_name from user_indexes
)
where segment_type in ( 'TABLE', 'INDEX' )
and segment_name = index_name (+)
order by 1, 2
/
spool off
set heading on
set verify on
set feedback on
set echo on
Received on Sun Dec 30 2001 - 02:49:27 CST