Move tables to a different tbs, the easy way
Mozno sa vam obcas pritrafi, ze potrebujete z nejakeho dovodu presunut velke mnozstvo tabuliek z jedneho tbs do ineho. V pripade ze tabulka nema index je to jednoducha vec, ale ked index ma problemy sa zacinaju. Tento skript sa o vsetko postara..
//move all non-indexed// select 'alter table '||t.owner||'.'||t.table_name|| 'move tablespace table_small;' from dba_tables t where t.tablespace_name='USERS' and t.table_name not in (select i.table_name from dba_indexes i where t.owner=i.owner and i.table_name=t.table_name); //move all indexed// select 'alter index '||i.owner||'.'||i.index_name||' unusable;' ,'alter table '||t.owner||'.'||t.table_name|| ' move tablespace table_small;' ,'alter index '||i.owner||'.'||i.index_name||' rebuild;' from dba_tables t, dba_indexes i where t.tablespace_name='USERS' and t.table_name=i.table_nameand t.owner=i.owner;