Chinaunix首页 | 论坛 | 博客
  • 博客访问: 650420
  • 博文数量: 789
  • 博客积分: 5000
  • 博客等级: 大校
  • 技术积分: 4985
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 09:29
文章分类

全部博文(789)

文章存档

2011年(1)

2008年(788)

我的朋友

分类:

2008-10-28 09:44:52


  Row Migration,是里面的一个重要的基本概念。
  一般传统意义上,我们需要消除行迁移。 因为这样,会造成额外的IO消耗。传统的办法一般是导入倒出整个表。
  但是这样的风险比较大,而且Downtime会比较长。
  当有外键约束之类的时候,也非常的麻烦。
  也有人选择用删除migration的行,然后重新Insert ,但是和Exp/Imp一样,当遭遇到FK/PK限制的时候,也会很头疼。
  我们可以用下面的办法来最方便的进行重组,消除row migration:
  SQL> alter table t add t1 date default sysdate;
   
  Table altered.
   
  SQL> c/t1/t2
    1* alter table t add t2 date default sysdate
  SQL> /
   
  Table altered.
   
  SQL> c/t2/t3
    1* alter table t add t3 date default sysdate
  SQL> /
   
  Table altered.
   
  SQL> analyze table t compute statistics;
   
  Table analyzed.
   
  SQL> select table_name,num_rows,CHAIN_CNT from user_tables where table_name='T';
   
  TABLE_NAME            NUM_ROWS CHAIN_CNT
  ------------------------------ ---------- ----------
  T                  41616    3908
   
  SQL> alter table t move ;
   
  Table altered.
   
  SQL> analyze table t compute statistics;
   
  Table analyzed.
   
  SQL> select table_name,num_rows,CHAIN_CNT from user_tables where table_name='T';
   
  TABLE_NAME            NUM_ROWS CHAIN_CNT
  ------------------------------ ---------- ----------
  T                  41616     0
【责编:admin】

--------------------next---------------------

阅读(393) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~