中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 数据库开发 > 数据库综合
相当方便快速消除行迁移的表的方法
作者:佚名 时间:2004-07-08 10:40 出处:互连网 责编:chinaitpower
              摘要:相当方便快速消除行迁移的表的方法

  Row Migration,是Oracle里面的一个重要的基本概念。
  一般传统意义上,我们需要消除行迁移。 因为这样,会造成额外的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
关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有