一、开启表的行迁移

alter table table_name enable row movement;

select 'alter table '||s.owner||'.'||s.table_name||' enable row movement;'  from dba_tables s where s.OWNER in ('ISMP');

二、开始shrink表与索引

alter table table_name shrink space cascade;

select 'alter table '||s.owner||'.'||s.table_name||' shrink space cascade;' from dba_tables s where s.OWNER in ('ISMP');

三、关闭行迁移

alter table table_name disable row movement;

select 'alter table '||s.owner||'.'||s.table_name||' disable row movement;'  from dba_tables s where s.OWNER in ('ISMP');

05-11 15:15