Oracle shrink space

一、开启表的行迁移

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');

猜你喜欢

转载自www.cnblogs.com/xibuhaohao/p/10329014.html
今日推荐