set linesize 300
set serveroutput on size 100000
set feedback off
spool rebuild.sql
begin
for rTabelas in (
SELECT owner, table_name, tablespace_name
FROM DBA_TABLES
) loop
dbms_output.put_line('alter table '|| rTabelas.owner ||'.'|| rTabelas.table_name ||' move tablespace '||rTabelas.tablespace_name||';');
for rIndex in (select index_name,tablespace_name,owner
from dba_indexes
where table_name = rTabelas.table_name) loop
dbms_output.put_line('alter index '|| rIndex.owner ||'.'|| rIndex.index_name ||' rebuild tablespace '||rIndex.tablespace_name||';');
end loop;
end loop;
end;
/
spool off
set serveroutput on size 100000
set feedback off
spool rebuild.sql
begin
for rTabelas in (
SELECT owner, table_name, tablespace_name
FROM DBA_TABLES
) loop
dbms_output.put_line('alter table '|| rTabelas.owner ||'.'|| rTabelas.table_name ||' move tablespace '||rTabelas.tablespace_name||';');
for rIndex in (select index_name,tablespace_name,owner
from dba_indexes
where table_name = rTabelas.table_name) loop
dbms_output.put_line('alter index '|| rIndex.owner ||'.'|| rIndex.index_name ||' rebuild tablespace '||rIndex.tablespace_name||';');
end loop;
end loop;
end;
/
spool off
Comentários
Postar um comentário