Oracle – Shrink de tabelas dentro da Tablespace (redução)

Execute o select abaixo:

select t.*,
‘ALTER ‘ || t.segment_type || ‘ ‘ || t.segment_name || ‘ ENABLE ROW MOVEMENT;’ as row_mov,
‘ALTER ‘ || t.segment_type || ‘ ‘ || t.segment_name || ‘ SHRINK SPACE CASCADE;’ as shrink
from (
select segment_name, segment_type, bytes/1024/1024 Size_Mb
from user_segments
where segment_type = ‘TABLE’
and not exists(
select 1
from user_tab_columns
where table_name = segment_name
and data_type IN (‘LONG’, ‘LONG RAW’))
order by bytes/1024/1024 DESC ) t;

Pegue o SQL gerado e execute novamente para dar shrink nas tabelas e realocar o espaço livre.

 

Você pode gostar...

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *