現在有一張表如下:
create table WRITE_USER
(
area_code ? ? ? ? ? ? ?VARCHAR2(8),
user_no ? ? ? ? ? ? ? ?VARCHAR2(20),
user_name ? ? ? ? ? ? ?VARCHAR2(100),
address ? ? ? ? ? ? ? ?VARCHAR2(100),
mon ? ? ? ? ? ? ? ? ? ?NUMBER(6),
mon_sn ? ? ? ? ? ? ? ? NUMBER(3),
write_flag ? ? ? ? ? ? CHAR(1),
write_type_code ? ? ? ?VARCHAR2(8),
write_sn ? ? ? ? ? ? ? VARCHAR2(32),
abnormal_code ? ? ? ? ?VARCHAR2(8)
)
partition by list (MON)
(
partition WRITE_USER_201203 values (201203)
tablespace PART_DATA
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
)
);,
由于每月的數據均超過百萬,所以進行了分區處理,建表時如上所示只按月份建立了一個分區,下個月的數據來了怎么辦?可以按下面的方法添加新分區:
alter table ?write_user add partition WRITE_USER_201304 values (201304)
建表完成后進行插入數據時,當mon為201304時,數據自動插入此分區,注意,mon值沒有對應的分區時,數據無法正常插入,報錯“ORA-14400:inserted partition key does not map to any partition”,必須有對應的分區才可以進行數據插入