(备注:range()指定数据库表中的某一字段作为数据存储到不同表空间的判断标准)
事例:
create tablespace ADC_BACK_1 datafile
'F:\Oracle\tablespaces\ADC_BACK_1.dnf' size 100M autoextend on next 100m
maxsize 20480m extent management local;
create tablespace ADC_BACK_2 datafile
'F:\Oracle\tablespaces\ADC_BACK_2.dnf' size 100M autoextend on next 100m
maxsize 20480m extent management local;
create tablespace ADC_BACK_3 datafile
'F:\Oracle\tablespaces\ADC_BACK_3.dnf' size 100M autoextend on next 100m
maxsize 20480m extent management local;
create tablespace ADC_BACK_4 datafile
'F:\Oracle\tablespaces\ADC_BACK_4.dnf' size 100M autoextend on next 100m
maxsize 20480m extent management local;
create tablespace ADC_BACK_5 datafile
'F:\Oracle\tablespaces\ADC_BACK_5.dnf' size 100M autoextend on next 100m
maxsize 20480m extent management local;
create table MON_PROCESS_RECORD_BACK(
INFOID VARCHAR2(36),
DIC_FLOWTYPE_ID VARCHAR2(36),
START_TIME DATE,
END_TIME DATE,
IS_SUCCESS CHAR(1),
ERROR_CODE VARCHAR2(2000),
DEL_FLAG CHAR(1),
ID VARCHAR2(36) PRIMARY KEY,
DEALWAY CHAR(1),
DETAIL VARCHAR2(4000),
DIC_EB_PLATFORM_ID VARCHAR2(36),
STATE VARCHAR2(100),
INSTRUCTION_ID VARCHAR2(36),
INSTRUCTION_NUM VARCHAR2(4),
EBI_INFO_CODE VARCHAR2(50),
IS_DISPLAY VARCHAR2(1)
)
partition by range(EBI_INFO_CODE)(
partition part_01 values less than('201608100000000000000') tablespace ADC_BACK_1,
partition part_02 values less than('201609100000000000000') tablespace ADC_BACK_2,
partition part_03 values less than('201610100000000000000') tablespace ADC_BACK_3,
partition part_04 values less than('201611100000000000000') tablespace ADC_BACK_4,
partition part_05 values less than('201612300000000000000') tablespace ADC_BACK_5,
partition part_06 values less than(maxvalue) tablespace USERS
);
转移数据:
insert into MON_PROCESS_RECORD_BACK(
INFOID,
DIC_FLOWTYPE_ID,
START_TIME,
END_TIME,
IS_SUCCESS,
ERROR_CODE,
DEL_FLAG,
ID,
DEALWAY,
DETAIL,
DIC_EB_PLATFORM_ID,
STATE,
INSTRUCTION_ID,
INSTRUCTION_NUM,
EBI_INFO_CODE,
IS_DISPLAY
)
select
INFOID,
DIC_FLOWTYPE_ID,
START_TIME,
END_TIME,
IS_SUCCESS,
ERROR_CODE,
DEL_FLAG,
ID,
DEALWAY,
DETAIL,
DIC_EB_PLATFORM_ID,
STATE,
INSTRUCTION_ID,
INSTRUCTION_NUM,
EBI_INFO_CODE,
IS_DISPLAY
from MON_PROCESS_RECORD;