Oracle大数据表的分表处理

1.首先给大数据表创建rownum序列号

--增加序列号字段
alter table TEST add xlh number;
--填充序列号
update TEST set xlh = rownum;

2.通过xlh字段进行分数据到不同的表中(以建表的方式进行处理)

create table hik_1001 as select clm1 as hik_clm1,clm2 as hik_clm2,clm3 as hik_clm3 from TEST where   xlh>=1 and xlh <=5000000;

create table hik_1002 as select clm1 as hik_clm1,clm2 as hik_clm2,clm3 as hik_clm3 from TEST where   xlh>=5000001 and xlh <=10000000;

create table hik_1003 as select clm1 as hik_clm1,clm2 as hik_clm2,clm3 as hik_clm3 from TEST where   xlh>=10000001 and xlh <=15000000;

create table hik_1004 as select clm1 as hik_clm1,clm2 as hik_clm2,clm3 as hik_clm3 from TEST where   xlh>=15000001;

3.给创建的表分别建立主键或者索引

create index hik_1001_index on HIK_1001  (HIK_CLM2)

alter table HIK_1001  add constraint HIK_1001_PKEY primary key (HIK_CLM1)

如果数据有重复的话,只需要建立索引就可以.

4.然后对分表后的数据进行处理

 

转载于:https://www.cnblogs.com/fxust/p/7221018.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值