oracle 不要建空表再导入数据,直接根据原表建成分区表

 脚本建分区表改下,不要建空表再导入数据,直接根据原表建成分区表
脚本参考:

create table tmp_acct_item_551_201502  parallel 4 nologging

partition  by range (part) 

  partition  part0 values less than (1) tablespace OFCS_TBS_ACCT,
  partition  part1 values less than (2) tablespace OFCS_TBS_ACCT,
  partition  part2 values less than (3) tablespace OFCS_TBS_ACCT,
  partition  part3 values less than (4) tablespace OFCS_TBS_ACCT,
  partition  part4 values less than (5) tablespace OFCS_TBS_ACCT,
  partition  part5 values less than (6) tablespace OFCS_TBS_ACCT,
  partition  part6 values less than (7) tablespace OFCS_TBS_ACCT,
  partition  part7 values less than (8) tablespace OFCS_TBS_ACCT,
  partition  part8 values less than (9) tablespace OFCS_TBS_ACCT,
  partition  part9 values less than (10) tablespace OFCS_TBS_ACCT 
)
 as 
select * from (
select a.prd_inst_id,a.charge,a.fee_type,to_number(substr(a.prd_inst_id,-1)) part 
from dat_acct_item_551_201502 a )   ; 

根据表里某个字段进行转换,做分区条件,建成分区表 

to_number(substr(a.prd_inst_id,-1)) part 
这个是根据原字段 进行转换做 分区条件  

你可能感兴趣的:(oracle 不要建空表再导入数据,直接根据原表建成分区表)