segunda-feira, 27 de abril de 2009

CURSOR PARA MOVER TABELAS E FAZER REBUILD DOS SEUS RESPECTIVOS INDICES

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

Nenhum comentário:

Postar um comentário

Docker Remove ALL Containers and Images

Caution: This command destroy ALL images and Containers. Recovery only possible if you have backed up properly. - Delete all containers ...