首页 > 数据库

oracle9i表在线重定义

时间:2009-05-15 06:05:39  作者:冰刀  我要投稿
Linux初探欢迎您的投稿,投放方法请点击这里查看,我们会定期赠送精美小礼品给优秀的投稿作者。海纳百川 取则行远!LinuxGoo欢迎您的到来。
author:skatetime:2009/05/12 最近公司有一个优化项目,为了提高系统的整体性能,我对数据库从表的底层开始优化,首先是表的存储参数的优化下面是在优化期间,把普通......

author:skate
time :2009/05/12


最近公司有一个优化项目,为了提高系统的整体性能,我对数据库从表的底层开始优化,首先是表的存储参数的优化
下面是在优化期间,把普通表转换为分区表

操作过程:

创建中间表:


create table d_batch_detail_his storage(initial 10m next 10m ) partition by range(ware_id)
(partition d_batch_detail_31100 values less than (31100) tablespace yytickets,
partition d_batch_detail_31600 values less than (31600) tablespace yytickets,
partition d_batch_detail_32100 values less than (32100) tablespace yytickets,
partition d_batch_detail_32600 values less than (32600) tablespace yytickets,
partition d_batch_detail_33100 values less than (33100) tablespace yytickets,
partition d_batch_detail_33600 values less than (33600) tablespace yytickets,
partition d_batch_detail_34100 values less than (34100) tablespace yytickets,
partition d_batch_detail_34600 values less than (34600) tablespace yytickets,
partition d_batch_detail_35100 values less than (35100) tablespace yytickets,
partition d_batch_detail_35600 values less than (35600) tablespace yytickets,
partition d_batch_detail_36100 values less than (36100) tablespace yytickets,
partition d_batch_detail_36600 values less than (36600) tablespace yytickets,
partition d_batch_detail_37100 values less than (37100) tablespace yytickets


)
as select * FROM d_batch_detail where 1=''


把普通表改变为分区表

SQL> exec dbms_redefinition.abort_redef_table('tickets','d_batch_detail','d_batch_detail_rep');

PL/SQL procedure successfully completed

SQL> exec dbms_redefinition.can_redef_table('tickets','d_batch_detail');

PL/SQL procedure successfully completed

SQL> exec dbms_redefinition.start_redef_table('tickets','d_batch_detail','d_batch_detail_rep');

PL/SQL procedure successfully completed

SQL> exec dbms_redefinition.sync_interim_table('tickets','d_batch_detail','d_batch_detail_rep');

PL/SQL procedure successfully completed

创建索引,约束,触发器等


create index IDXa_BATCH_DETAIL_ORDERDETAILI on d_batch_detail_rep(ORDER_DETAIL_ID)

如果您需转载 oracle9i表在线重定义,请注明来自LinuxGoo.com,其版权归原作者所有。请广大网友留言时遵纪守法,使用文明用语。如果您在应用中有什么问题,请在下面留言,我们会尽快解答。
来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
相关文章
栏目热门