重定义对象简易总结

1、重组织表模式:
(1)OFFLINE
 ⊙ MOVE表
 ⊙ CTAS
    ◎ Create Table As Select
    ◎ index
    ◎ constrain
    ◎ drop old table
    ◎ rename new table
⊙ EXP/IMP,EXPDP/IMPDP
⊙ REBUILD

(2)ONLINE
alter table <table> shrink space <compact>;
  alter index <index> shrink space <compact>;


--------------------------------------------------------------------------------
1、OFFLINE
 分两种方式:offline,cats
(1)MOVE表
⊙ 基于表的MOVE操作
⊙ 在执行MOVE时,查询仍然执行             
⊙ MOVE后索引失效,需要REBUILD
⊙ DML的受限时间 =  MOVE的时间 + REBUILD 索引的时间
⊙ 查询的受限时间 = REBUILD 索引的时间,因为索引无法使用.
所以,MOVE表的时候,如果不使用索引,那么查询没有影响


(2)CTAS实现的方式: ( Create Table As Select)
1) Create table as select  (create table t as select * from test;)
2) index  
3) constrain
4) drop old table
5) rename new table
该方法,DML时跟MOVE同样的受限时间,查询的受限时间非常短 = DROP OLD TABLE + RENAME NEW TABLE,
drop table,我们说通常是很快的, 需要更多的空间 = 2倍表大小 + 2倍索引大小

2、online
alter table <table> shrink space <compact>;
alter index <index> shrink space <compact>;
 rebuild和coalesce(shrink space )的优点及成本:
 
rebuild index                                      coalesce index   
能快速在表空间移动                     不能实现表空间移动   
磁盘空间需要高成本                    磁盘空间低成本,不需要很多磁盘空间   
需要重建整个索引                        只整合一个分支节点下的页块   
能快速改变存储参数                    只能用于整理页块 
 
 ORACLE提供了分析索引结构的语法: ANALYZE INDEX … VALIDATE STRUCTURE

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值