ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 重定义分区表

重定义分区表

原创 Linux操作系统 作者:ziling2011 时间:2011-12-02 17:03:15 0 删除 编辑

1.验证表
exec DBMS_REDEFINITION.CAN_REDEF_TABLE('RMSDEV','RMS_RESUME_TAB', dbms_redefinition.cons_use_pk);

exec dbms_redefinition.can_redef_table('SCOTT','VHE',dbms_redefinition.cons_use_rowid);
 
2.建中间表vhe_tmp
3.开始重定义
exec dbms_redefinition.start_redef_table(uname => 'SCOTT',
 orig_table => 'VHE',
 int_table=> 'VHE_TMP',
 options_flag => dbms_redefinition.cons_use_rowid);

4.拷贝依赖和被依赖的约束和索引信息等
 DECLARE
    retval NUMBER(5);
 BEGIN
 dbms_redefinition.copy_table_dependents(uname => 'SCOTT',
  orig_table       => 'VHE',
  int_table        => 'VHE_TMP',
  copy_constraints => false,
  num_errors       => retval);
     dbms_output.put_line(retval);
  END;    

5.同步数据
exec dbms_redefinition.sync_interim_table('SCOTT', 'VHE', 'VHE_TMP');

6.完成重定义
EXEC DBMS_REDEFINITION.finish_redef_table ('SCOTT', 'VHE', 'VHE_TMP');

重定义表,更改表属性将name字段varchar2类型改为number

begin
   dbms_redefinition.start_redef_table(uname => 'LUOLUO',
   orig_table => 'T2',
   int_table=> 'T3',
   col_mapping=>'id id,to_number(name) name1',
   options_flag => dbms_redefinition.cons_use_rowid);
 end;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25989950/viewspace-712639/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: oracle手动安装
请登录后发表评论 登录
全部评论

注册时间:2011-07-18

  • 博文量
    52
  • 访问量
    130197