shrink VS move +rebuild online
来源:互联网 发布:淘客云购cms 编辑:程序博客网 时间:2024/04/28 23:04
version:10.2.0.4
1. 由于库里空间有限进行日志表的清理
开始使用 类似以下命令进行整理,结果发现可在线做不产生阻塞,但是缺点也非常明显,碎片整理效果差,耗时,产生大量的日志,而且将整理的会话kill后将回GUN,也就是之前的白做了,而且相关对象如触发器,存储过程在整理后还要重新编译,也就是会产生无效对象;
sql_1:='alter table table1 enable row movement';
sql_2:='alter table table1 shrink space cascade';
2.鉴于是日志表所以尝试用move+rebuild online来尝试,结果很明显,优点大于缺点,对于类似日志表可以此方法;
类似如下代码:
declare
cont number;
begin
<<next_loop>>
select count(1) into cont from v$locked_object where object_id=953347;--判断此对象是否加锁,否则进行MOVE时报错;
if cont=1 then
dbms_lock.sleep(10); --停10秒,避免频繁循环
goto next_loop; --下一个循环
end if;
execute immediate 'alter table table_name move'; --表整理
execute immediate 'alter index inx_name rebuild online'; --索引整理
end;
结果:效果显著,表由之前的6G降到3G,所有索引大小由11G降到3G,耗时1个钟左右;
当然有个前提,之所以碎片那么厉害是我意料的,因为此表每天都进行数据的迁移(迁多少删多少);
MOVE功能类似于ctas + drop old_table purge,所以在MOVE过程中会先占用掉表之前的大小(举例,表不含碎片20G,那么MOVE时候会先消耗掉20G的空间),要留意下表空间的剩余空间大小;
业务表不建议这样做,MOVE操作时就会生6的阻塞锁,所有的DML表的操作就等待,而且做完,索引是失效,需衡量下,安排在空闲时候做;
- shrink VS move +rebuild online
- rebuild index VS. rebuild index online
- 收缩数据表空间(move & shrink)+索引表空间(rebuild)
- index rebuild vs index coalesce vs index shrink
- 重建索引:ALTER INDEX..REBUILD ONLINE vs ALTER INDEX..REBUILD
- rebuild 和rebuild online
- shrink segment online
- rebuild table online
- oracle index rebuild online
- oracle shrink space 与move
- rebuild和rebuild online的区别
- index rebuild和rebuild online的区别
- alter index rebuild 与 rebuild online
- alter index rebuild & alter index rebuild online
- alter index rebuild & alter index rebuild online
- 索引create|rebuild|rebulid online
- index rebuild online 工作日志
- 表级碎片整理shrink/move
- HTML中为何P标签内不可包含DIV标签?
- 网站建设中关于并发连接数的解释
- Mysql存储引擎
- POJ 1981 Circle and Points(单位圆覆盖n^3&&n^2lgn)
- Editor:实用的在线编辑器(WYSIWYG Editor)
- shrink VS move +rebuild online
- android traceview分析
- java swing的编辑框如果用智能ABC输入法输入中文会整个应用程序崩掉
- SIP基本应用方案
- Apache Tomcat 负载均衡集成
- MySQL系统表附上
- 怎么在SQLServer数据库创建多个ArcSDE服务
- C# 的数据类型转换 c#字符串转换格式 c#日期数字字符串整形格式转换
- Android开发错误汇总 .