ORA-14037 分区界限过高的原因分析及解决 [转]

在使用以下语句列表分区法创建分区表时 

SQL> create table T_parttab_str
  2  (
  3    PROVINCE_ID varchar2(8) not null,
  4    con_autoid      NUMBER(10) not null,
  5    RI_ID       NUMBER(10),
  6    MATER_NO    NVARCHAR2(20),
  7    MATER_NUM   NUMBER(15,6),
  8    MATER_TYPE  NVARCHAR2(2)
  9  )
 10  partition by range (PROVINCE_ID)
 11  subpartition by hash (con_autoid)
 12  subpartitions 8 store  in (tp_data,tp_hotdata)
 13  (
 14    PARTITION p1 VALUES LESS THAN ('2'),
 15  PARTITION p2 VALUES LESS THAN ('3'),
 16  PARTITION p3 VALUES LESS THAN ('4'),
 17  PARTITION p4 VALUES LESS THAN ('5'),
 18  PARTITION p5 VALUES LESS THAN ('6'),
 19  PARTITION p6 VALUES LESS THAN ('7'),
 20  PARTITION p7 VALUES LESS THAN ('8'),
 21  PARTITION p8 VALUES LESS THAN ('9'),
 22  PARTITION p9 VALUES LESS THAN ('10'),
 23  PARTITION p10 VALUES LESS THAN ('11'),
 24  PARTITION p11 VALUES LESS THAN ('12'),
 25    PARTITION p32 VALUES LESS THAN (maxvalue)
 26  )
 27  ;

create table T_parttab_str
(
  PROVINCE_ID varchar2(8) not null,
  con_autoid      NUMBER(10) not null,
  RI_ID       NUMBER(10),
  MATER_NO    NVARCHAR2(20),
  MATER_NUM   NUMBER(15,6),
  MATER_TYPE  NVARCHAR2(2)
)
partition by range (PROVINCE_ID)
subpartition by hash (con_autoid)
subpartitions 8 store  in (tp_data,tp_hotdata)
(
  PARTITION p1 VALUES LESS THAN ('2'),
PARTITION p2 VALUES LESS THAN ('3'),
PARTITION p3 VALUES LESS THAN ('4'),
PARTITION p4 VALUES LESS THAN ('5'),
PARTITION p5 VALUES LESS THAN ('6'),
PARTITION p6 VALUES LESS THAN ('7'),
PARTITION p7 VALUES LESS THAN ('8'),
PARTITION p8 VALUES LESS THAN ('9'),
PARTITION p9 VALUES LESS THAN ('10'),
PARTITION p10 VALUES LESS THAN ('11'),
PARTITION p11 VALUES LESS THAN ('12'),
  PARTITION p32 VALUES LESS THAN (maxvalue)
)

ORA-14037: 分区 "P8" 的分区界限过高

SQL>

查oracle 错误文档 ORA-14037

ORA-14037 partition bound of partition "string" is too high
Cause: High bound of the partition whose name (explicitly specified by the
user) is displayed in this message did not collate lower than that of the
following partition, which is illegal.
Action: Ensure that high bound of every partition (except for the last one)
collates lower than that of a following partition.

 原来是分区p8的分区界限比P9的大了,按通常的理解 9 比10小,但是oracle比较字符串时,会首先从第一个字符比较。因为"9">"1",所以会认为"9"

将上面的改为

SQL> create table T_parttab_str
  2  (
  3    PROVINCE_ID varchar2(8) not null,
  4    con_autoid      NUMBER(10) not null,
  5    RI_ID       NUMBER(10),
  6    MATER_NO    NVARCHAR2(20),
  7    MATER_NUM   NUMBER(15,6),
  8    MATER_TYPE  NVARCHAR2(2)
  9  )
 10  partition by range (PROVINCE_ID)
 11  subpartition by hash (con_autoid)
 12  subpartitions 8 store  in (tp_data,tp_hotdata)
 13  (
 14    PARTITION p1 VALUES LESS THAN ('02'),
 15  PARTITION p2 VALUES LESS THAN ('03'),
 16  PARTITION p3 VALUES LESS THAN ('04'),
 17  PARTITION p4 VALUES LESS THAN ('05'),
 18  PARTITION p5 VALUES LESS THAN ('06'),
 19  PARTITION p6 VALUES LESS THAN ('07'),
 20  PARTITION p7 VALUES LESS THAN ('08'),
 21  PARTITION p8 VALUES LESS THAN ('09'),
 22  PARTITION p9 VALUES LESS THAN ('10'),
 23  PARTITION p10 VALUES LESS THAN ('11'),
 24  PARTITION p11 VALUES LESS THAN ('12'),
 25    PARTITION p32 VALUES LESS THAN (maxvalue)
 26  )
 27  ;

Table created

SQL>

 成功创建。

建议:

       范围分区时,分区键尽量不用字符型。如果字符型时要注意保持字符位数一致以避免出现意想不到的情况

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

转载于:http://blog.itpub.net/27036311/viewspace-736061/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值