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.然后對分表后的數據進行處理

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM