欣欣闹天下

古有洛离感青天,乾坤泣血憾无言。时光无情终逝去,唯留玲珑血玉兰。

导航

记一次oracle单表改分区表 一波三折

业务上要把单表还差分区表

SQL> @seg gwx.aopen

SEG_MB OWNER SEGMENT_NAME SEG_PART_NAME SEGMENT_TYPE SEG_TABLESPACE_NAME BLOCKS HDRFIL HDRBLK
---------- -------------------- ------------------------------ ------------------------------ -------------------- ------------------------------ ---------- ---------- ----------
156869 GWX AOPEN TABLE SERVICE_MAIN_DAT 10039616 10 1615622
----------
156869

SQL> @desc gwx.aopen
Name Null? Type


1 REQSEQ NOT NULL VARCHAR2(32)
2 APPID VARCHAR2(64)
3 APIID VARCHAR2(64)
4 REQUESTIP VARCHAR2(128)
5 BEGINTIME VARCHAR2(32)
6 INTIME DATE
7 OID NUMBER(16)
8 CHANNELID VARCHAR2(64)
9 VERSION VARCHAR2(64)
10 SERVICEID VARCHAR2(64)
11 RSPCONTENT VARCHAR2(1024)
12 SERVELAPSEPERIOD VARCHAR2(32)
13 ENDTIME VARCHAR2(32)
14 RETCODE VARCHAR2(10)
15 RETMSG VARCHAR2(256)
16 ROUTEVALUE VARCHAR2(14)
17 ROUTETYPE NUMBER(1)
18 AREACODE NUMBER(5)
19 SRCCODE VARCHAR2(14)
20 ISCACHE NUMBER(1)
21 H5PAGEID VARCHAR2(32)



SQL> @ind
Display indexes where table or index name matches %%AOPEN.AOPEN_API_CDRREQ_NEW%%...

TABLE_OWNER TABLE_NAME INDEX_NAME POS# COLUMN_NAME DSC
-------------------- ------------------------------ ------------------------------ ---- ------------------------------ ----
GWX AOPEN IND_API_CDRREQ_NEW 1 REQSERQ
2 INTIME


INDEX_OWNER TABLE_NAME INDEX_NAME IDXTYPE UNIQ STATUS PART TEMP H LFBLKS NDK NUM_ROWS CLUF LAST_ANALYZED DEGREE VISIBILIT
-------------------- ------------------------------ ------------------------------ ---------- ---- -------- ---- ---- -- ---------- ------------- ---------- ---------- ----------------- ------ ---------
GWX AOPEN IND_API_CDRREQ_NEW NORMAL NO VALID NO N 3 73570 21407470 21407764 570571 20201103 17:44:09 1 VISIBLE



SQL> alter TABLE gwx.aopen MODIFY
2 PARTITION BY RANGE ("INTIME")
3 (
4 PARTITION "PART_20210601" VALUES LESS THAN (TO_DATE(' 2021-06-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
5 PARTITION "PART_20210602" VALUES LESS THAN (TO_DATE(' 2021-06-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
6 PARTITION "PART_20210603" VALUES LESS THAN (TO_DATE(' 2021-06-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
7 PARTITION "PART_20210604" VALUES LESS THAN (TO_DATE(' 2021-06-05 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
8 PARTITION "PART_20210605" VALUES LESS THAN (TO_DATE(' 2021-06-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
9 PARTITION "PART_20210606" VALUES LESS THAN (TO_DATE(' 2021-06-07 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
10 PARTITION "PART_20210607" VALUES LESS THAN (TO_DATE(' 2021-06-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
11 PARTITION "PART_20210608" VALUES LESS THAN (TO_DATE(' 2021-06-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
12 PARTITION "PART_20210609" VALUES LESS THAN (TO_DATE(' 2021-06-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
13 PARTITION "PART_20210610" VALUES LESS THAN (TO_DATE(' 2021-06-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
14 PARTITION "PART_20210611" VALUES LESS THAN (TO_DATE(' 2021-06-12 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
15 PARTITION "PART_20210612" VALUES LESS THAN (TO_DATE(' 2021-06-13 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
16 PARTITION "PART_20210613" VALUES LESS THAN (TO_DATE(' 2021-06-14 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
17 PARTITION "PART_20210614" VALUES LESS THAN (TO_DATE(' 2021-06-15 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
18 PARTITION "PART_20210615" VALUES LESS THAN (TO_DATE(' 2021-06-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
19 PARTITION "PART_20210616" VALUES LESS THAN (TO_DATE(' 2021-06-17 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
20 PARTITION "PART_20210617" VALUES LESS THAN (TO_DATE(' 2021-06-18 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
21 PARTITION "PART_20210618" VALUES LESS THAN (TO_DATE(' 2021-06-19 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
22 PARTITION "PART_20210619" VALUES LESS THAN (TO_DATE(' 2021-06-20 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
23 PARTITION "PART_20210620" VALUES LESS THAN (TO_DATE(' 2021-06-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
24 PARTITION "PART_20210621" VALUES LESS THAN (TO_DATE(' 2021-06-22 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
25 PARTITION "PART_20210622" VALUES LESS THAN (TO_DATE(' 2021-06-23 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
26 PARTITION "PART_20210623" VALUES LESS THAN (TO_DATE(' 2021-06-24 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
27 PARTITION "PART_20210624" VALUES LESS THAN (TO_DATE(' 2021-06-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
28 PARTITION "PART_20210625" VALUES LESS THAN (TO_DATE(' 2021-06-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
29 PARTITION "PART_20210626" VALUES LESS THAN (TO_DATE(' 2021-06-27 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
30 PARTITION "PART_20210627" VALUES LESS THAN (TO_DATE(' 2021-06-28 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
31 PARTITION "PART_20210628" VALUES LESS THAN (TO_DATE(' 2021-06-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
32 PARTITION "PART_20210629" VALUES LESS THAN (TO_DATE(' 2021-06-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
33 PARTITION "PART_20210630" VALUES LESS THAN (TO_DATE(' 2021-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
34 PARTITION "PART_20210701" VALUES LESS THAN (TO_DATE(' 2021-07-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
35 PARTITION "PART_20210702" VALUES LESS THAN (TO_DATE(' 2021-07-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
36 PARTITION "PART_20210703" VALUES LESS THAN (TO_DATE(' 2021-07-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
37 PARTITION "PART_20210704" VALUES LESS THAN (TO_DATE(' 2021-07-05 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
38 PARTITION "PART_20210705" VALUES LESS THAN (TO_DATE(' 2021-07-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
39 PARTITION "PART_20210706" VALUES LESS THAN (TO_DATE(' 2021-07-07 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
40 PARTITION "PART_20210707" VALUES LESS THAN (TO_DATE(' 2021-07-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
41 PARTITION "PART_20210708" VALUES LESS THAN (TO_DATE(' 2021-07-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
42 PARTITION "PART_20210709" VALUES LESS THAN (TO_DATE(' 2021-07-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
43 PARTITION "PART_20210710" VALUES LESS THAN (TO_DATE(' 2021-07-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
44 PARTITION "PART_20210711" VALUES LESS THAN (TO_DATE(' 2021-07-12 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
45 PARTITION "PART_20210712" VALUES LESS THAN (TO_DATE(' 2021-07-13 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
46 PARTITION "PART_20210713" VALUES LESS THAN (TO_DATE(' 2021-07-14 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
47 PARTITION "PART_20210714" VALUES LESS THAN (TO_DATE(' 2021-07-15 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
48 PARTITION "PART_20210715" VALUES LESS THAN (TO_DATE(' 2021-07-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
49 PARTITION "PART_20210716" VALUES LESS THAN (TO_DATE(' 2021-07-17 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
50 PARTITION "PART_20210717" VALUES LESS THAN (TO_DATE(' 2021-07-18 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
51 PARTITION "PART_20210718" VALUES LESS THAN (TO_DATE(' 2021-07-19 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
52 PARTITION "PART_20210719" VALUES LESS THAN (TO_DATE(' 2021-07-20 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
53 PARTITION "PART_20210720" VALUES LESS THAN (TO_DATE(' 2021-07-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
54 PARTITION "PART_20210721" VALUES LESS THAN (TO_DATE(' 2021-07-22 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
55 PARTITION "PART_20210722" VALUES LESS THAN (TO_DATE(' 2021-07-23 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
56 PARTITION "PART_20210723" VALUES LESS THAN (TO_DATE(' 2021-07-24 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
57 PARTITION "PART_20210724" VALUES LESS THAN (TO_DATE(' 2021-07-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
58 PARTITION "PART_20210725" VALUES LESS THAN (TO_DATE(' 2021-07-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
59 PARTITION "PART_20210726" VALUES LESS THAN (TO_DATE(' 2021-07-27 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
60 PARTITION "PART_20210727" VALUES LESS THAN (TO_DATE(' 2021-07-28 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
61 PARTITION "PART_20210728" VALUES LESS THAN (TO_DATE(' 2021-07-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
62 PARTITION "PART_20210729" VALUES LESS THAN (TO_DATE(' 2021-07-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
63 PARTITION "PART_20210730" VALUES LESS THAN (TO_DATE(' 2021-07-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
64 PARTITION "PART_20210731" VALUES LESS THAN (TO_DATE(' 2021-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
65 PARTITION "PART_20210801" VALUES LESS THAN (TO_DATE(' 2021-08-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
66 PARTITION "PART_20210802" VALUES LESS THAN (TO_DATE(' 2021-08-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
67 PARTITION "PART_20210803" VALUES LESS THAN (TO_DATE(' 2021-08-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
68 PARTITION "PART_20210804" VALUES LESS THAN (TO_DATE(' 2021-08-05 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
69 PARTITION "PART_20210805" VALUES LESS THAN (TO_DATE(' 2021-08-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
70 PARTITION "PART_20210806" VALUES LESS THAN (TO_DATE(' 2021-08-07 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
71 PARTITION "PART_20210807" VALUES LESS THAN (TO_DATE(' 2021-08-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
72 PARTITION "PART_20210808" VALUES LESS THAN (TO_DATE(' 2021-08-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
73 PARTITION "PART_20210809" VALUES LESS THAN (TO_DATE(' 2021-08-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
74 PARTITION "PART_20210810" VALUES LESS THAN (TO_DATE(' 2021-08-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
75 PARTITION "PART_20210811" VALUES LESS THAN (TO_DATE(' 2021-08-12 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
76 PARTITION "PART_20210812" VALUES LESS THAN (TO_DATE(' 2021-08-13 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
77 PARTITION "PART_20210813" VALUES LESS THAN (TO_DATE(' 2021-08-14 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
78 PARTITION "PART_20210814" VALUES LESS THAN (TO_DATE(' 2021-08-15 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
79 PARTITION "PART_20210815" VALUES LESS THAN (TO_DATE(' 2021-08-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
80 PARTITION "PART_20210816" VALUES LESS THAN (TO_DATE(' 2021-08-17 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
81 PARTITION "PART_20210817" VALUES LESS THAN (TO_DATE(' 2021-08-18 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
82 PARTITION "PART_20210818" VALUES LESS THAN (TO_DATE(' 2021-08-19 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
83 PARTITION "PART_20210819" VALUES LESS THAN (TO_DATE(' 2021-08-20 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
84 PARTITION "PART_20210820" VALUES LESS THAN (TO_DATE(' 2021-08-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
85 PARTITION "PART_20210821" VALUES LESS THAN (TO_DATE(' 2021-08-22 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
86 PARTITION "PART_20210822" VALUES LESS THAN (TO_DATE(' 2021-08-23 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
87 PARTITION "PART_20210823" VALUES LESS THAN (TO_DATE(' 2021-08-24 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
88 PARTITION "PART_20210824" VALUES LESS THAN (TO_DATE(' 2021-08-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
89 PARTITION "PART_20210825" VALUES LESS THAN (TO_DATE(' 2021-08-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
90 PARTITION "PART_20210826" VALUES LESS THAN (TO_DATE(' 2021-08-27 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
91 PARTITION "PART_20210827" VALUES LESS THAN (TO_DATE(' 2021-08-28 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
92 PARTITION "PART_20210828" VALUES LESS THAN (TO_DATE(' 2021-08-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
93 PARTITION "PART_20210829" VALUES LESS THAN (TO_DATE(' 2021-08-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
94 PARTITION "PART_20210830" VALUES LESS THAN (TO_DATE(' 2021-08-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
95 PARTITION "PART_20210831" VALUES LESS THAN (TO_DATE(' 2021-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
96 PARTITION "PART_MAX" VALUES LESS THAN (TO_DATE(' 3000-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE
97 )
98 /
PARTITION BY RANGE ("INTIME")
*
ERROR at line 2:
ORA-14006: invalid partition name

当时想是不是哪里写错了,检查了多次,也让同事看了也没有什么异常。既然写的问题就往别处想想

原因:在线 单表改分区表是在12c的版本,在11.2.0.4 不支持。

既然alter table modify用不了,就想先把单表 rename 创建新的分区表 在insert into回去。


SQL> create TABLE gwx.aopen
2 ( "REQSEQ" VARCHAR2(32) NOT NULL ENABLE,
3 "APPID" VARCHAR2(64),
4 "APIID" VARCHAR2(64),
5 "REQUESTIP" VARCHAR2(128),
6 "BEGINTIME" VARCHAR2(32),
7 "INTIME" DATE DEFAULT (sysdate),
8 "OID" NUMBER(16,0),
9 "CHANNELID" VARCHAR2(64),
10 "VERSION" VARCHAR2(64),
11 "SERVICEID" VARCHAR2(64),
12 "RSPCONTENT" VARCHAR2(1024),
13 "SERVELAPSEPERIOD" VARCHAR2(32),
14 "ENDTIME" VARCHAR2(32),
15 "RETCODE" VARCHAR2(10),
16 "RETMSG" VARCHAR2(256),
17 "ROUTEVALUE" VARCHAR2(14),
18 "ROUTETYPE" NUMBER(1,0),
19 "AREACODE" NUMBER(5,0),
20 "SRCCODE" VARCHAR2(14),
21 "ISCACHE" NUMBER(1,0),
22 "H5PAGEID" VARCHAR2(32)
23 )
24 PARTITION BY RANGE ("INTIME")
25 (
26 PARTITION "PART_20210601" VALUES LESS THAN (TO_DATE(' 2021-06-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
27 PARTITION "PART_20210602" VALUES LESS THAN (TO_DATE(' 2021-06-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
28 PARTITION "PART_20210603" VALUES LESS THAN (TO_DATE(' 2021-06-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
29 PARTITION "PART_20210604" VALUES LESS THAN (TO_DATE(' 2021-06-05 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
30 PARTITION "PART_20210605" VALUES LESS THAN (TO_DATE(' 2021-06-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
31 PARTITION "PART_20210606" VALUES LESS THAN (TO_DATE(' 2021-06-07 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
32 PARTITION "PART_20210607" VALUES LESS THAN (TO_DATE(' 2021-06-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
33 PARTITION "PART_20210608" VALUES LESS THAN (TO_DATE(' 2021-06-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
34 PARTITION "PART_20210609" VALUES LESS THAN (TO_DATE(' 2021-06-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
35 PARTITION "PART_20210610" VALUES LESS THAN (TO_DATE(' 2021-06-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
36 PARTITION "PART_20210611" VALUES LESS THAN (TO_DATE(' 2021-06-12 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
37 PARTITION "PART_20210612" VALUES LESS THAN (TO_DATE(' 2021-06-13 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
38 PARTITION "PART_20210613" VALUES LESS THAN (TO_DATE(' 2021-06-14 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
39 PARTITION "PART_20210614" VALUES LESS THAN (TO_DATE(' 2021-06-15 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
40 PARTITION "PART_20210615" VALUES LESS THAN (TO_DATE(' 2021-06-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
41 PARTITION "PART_20210616" VALUES LESS THAN (TO_DATE(' 2021-06-17 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
42 PARTITION "PART_20210617" VALUES LESS THAN (TO_DATE(' 2021-06-18 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
43 PARTITION "PART_20210618" VALUES LESS THAN (TO_DATE(' 2021-06-19 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
44 PARTITION "PART_20210619" VALUES LESS THAN (TO_DATE(' 2021-06-20 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
45 PARTITION "PART_20210620" VALUES LESS THAN (TO_DATE(' 2021-06-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
46 PARTITION "PART_20210621" VALUES LESS THAN (TO_DATE(' 2021-06-22 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
47 PARTITION "PART_20210622" VALUES LESS THAN (TO_DATE(' 2021-06-23 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
48 PARTITION "PART_20210623" VALUES LESS THAN (TO_DATE(' 2021-06-24 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
49 PARTITION "PART_20210624" VALUES LESS THAN (TO_DATE(' 2021-06-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
50 PARTITION "PART_20210625" VALUES LESS THAN (TO_DATE(' 2021-06-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
51 PARTITION "PART_20210626" VALUES LESS THAN (TO_DATE(' 2021-06-27 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
52 PARTITION "PART_20210627" VALUES LESS THAN (TO_DATE(' 2021-06-28 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
53 PARTITION "PART_20210628" VALUES LESS THAN (TO_DATE(' 2021-06-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
54 PARTITION "PART_20210629" VALUES LESS THAN (TO_DATE(' 2021-06-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
55 PARTITION "PART_20210630" VALUES LESS THAN (TO_DATE(' 2021-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
56 PARTITION "PART_20210701" VALUES LESS THAN (TO_DATE(' 2021-07-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
57 PARTITION "PART_20210702" VALUES LESS THAN (TO_DATE(' 2021-07-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
58 PARTITION "PART_20210703" VALUES LESS THAN (TO_DATE(' 2021-07-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
59 PARTITION "PART_20210704" VALUES LESS THAN (TO_DATE(' 2021-07-05 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
60 PARTITION "PART_20210705" VALUES LESS THAN (TO_DATE(' 2021-07-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
61 PARTITION "PART_20210706" VALUES LESS THAN (TO_DATE(' 2021-07-07 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
62 PARTITION "PART_20210707" VALUES LESS THAN (TO_DATE(' 2021-07-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
63 PARTITION "PART_20210708" VALUES LESS THAN (TO_DATE(' 2021-07-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
64 PARTITION "PART_20210709" VALUES LESS THAN (TO_DATE(' 2021-07-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
65 PARTITION "PART_20210710" VALUES LESS THAN (TO_DATE(' 2021-07-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
66 PARTITION "PART_20210711" VALUES LESS THAN (TO_DATE(' 2021-07-12 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
67 PARTITION "PART_20210712" VALUES LESS THAN (TO_DATE(' 2021-07-13 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
68 PARTITION "PART_20210713" VALUES LESS THAN (TO_DATE(' 2021-07-14 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
69 PARTITION "PART_20210714" VALUES LESS THAN (TO_DATE(' 2021-07-15 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
70 PARTITION "PART_20210715" VALUES LESS THAN (TO_DATE(' 2021-07-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
71 PARTITION "PART_20210716" VALUES LESS THAN (TO_DATE(' 2021-07-17 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
72 PARTITION "PART_20210717" VALUES LESS THAN (TO_DATE(' 2021-07-18 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
73 PARTITION "PART_20210718" VALUES LESS THAN (TO_DATE(' 2021-07-19 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
74 PARTITION "PART_20210719" VALUES LESS THAN (TO_DATE(' 2021-07-20 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
75 PARTITION "PART_20210720" VALUES LESS THAN (TO_DATE(' 2021-07-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
76 PARTITION "PART_20210721" VALUES LESS THAN (TO_DATE(' 2021-07-22 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
77 PARTITION "PART_20210722" VALUES LESS THAN (TO_DATE(' 2021-07-23 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
78 PARTITION "PART_20210723" VALUES LESS THAN (TO_DATE(' 2021-07-24 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
79 PARTITION "PART_20210724" VALUES LESS THAN (TO_DATE(' 2021-07-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
80 PARTITION "PART_20210725" VALUES LESS THAN (TO_DATE(' 2021-07-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
81 PARTITION "PART_20210726" VALUES LESS THAN (TO_DATE(' 2021-07-27 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
82 PARTITION "PART_20210727" VALUES LESS THAN (TO_DATE(' 2021-07-28 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
83 PARTITION "PART_20210728" VALUES LESS THAN (TO_DATE(' 2021-07-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
84 PARTITION "PART_20210729" VALUES LESS THAN (TO_DATE(' 2021-07-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
85 PARTITION "PART_20210730" VALUES LESS THAN (TO_DATE(' 2021-07-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
86 PARTITION "PART_20210731" VALUES LESS THAN (TO_DATE(' 2021-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
87 PARTITION "PART_20210801" VALUES LESS THAN (TO_DATE(' 2021-08-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
88 PARTITION "PART_20210802" VALUES LESS THAN (TO_DATE(' 2021-08-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
89 PARTITION "PART_20210803" VALUES LESS THAN (TO_DATE(' 2021-08-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
90 PARTITION "PART_20210804" VALUES LESS THAN (TO_DATE(' 2021-08-05 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
91 PARTITION "PART_20210805" VALUES LESS THAN (TO_DATE(' 2021-08-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
92 PARTITION "PART_20210806" VALUES LESS THAN (TO_DATE(' 2021-08-07 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
93 PARTITION "PART_20210807" VALUES LESS THAN (TO_DATE(' 2021-08-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
94 PARTITION "PART_20210808" VALUES LESS THAN (TO_DATE(' 2021-08-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
95 PARTITION "PART_20210809" VALUES LESS THAN (TO_DATE(' 2021-08-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
96 PARTITION "PART_20210810" VALUES LESS THAN (TO_DATE(' 2021-08-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
97 PARTITION "PART_20210811" VALUES LESS THAN (TO_DATE(' 2021-08-12 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
98 PARTITION "PART_20210812" VALUES LESS THAN (TO_DATE(' 2021-08-13 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
99 PARTITION "PART_20210813" VALUES LESS THAN (TO_DATE(' 2021-08-14 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
100 PARTITION "PART_20210814" VALUES LESS THAN (TO_DATE(' 2021-08-15 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
101 PARTITION "PART_20210815" VALUES LESS THAN (TO_DATE(' 2021-08-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
102 PARTITION "PART_20210816" VALUES LESS THAN (TO_DATE(' 2021-08-17 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
103 PARTITION "PART_20210817" VALUES LESS THAN (TO_DATE(' 2021-08-18 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
104 PARTITION "PART_20210818" VALUES LESS THAN (TO_DATE(' 2021-08-19 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
105 PARTITION "PART_20210819" VALUES LESS THAN (TO_DATE(' 2021-08-20 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
106 PARTITION "PART_20210820" VALUES LESS THAN (TO_DATE(' 2021-08-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
107 PARTITION "PART_20210821" VALUES LESS THAN (TO_DATE(' 2021-08-22 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
108 PARTITION "PART_20210822" VALUES LESS THAN (TO_DATE(' 2021-08-23 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
109 PARTITION "PART_20210823" VALUES LESS THAN (TO_DATE(' 2021-08-24 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
110 PARTITION "PART_20210824" VALUES LESS THAN (TO_DATE(' 2021-08-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
111 PARTITION "PART_20210825" VALUES LESS THAN (TO_DATE(' 2021-08-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
112 PARTITION "PART_20210826" VALUES LESS THAN (TO_DATE(' 2021-08-27 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
113 PARTITION "PART_20210827" VALUES LESS THAN (TO_DATE(' 2021-08-28 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
114 PARTITION "PART_20210828" VALUES LESS THAN (TO_DATE(' 2021-08-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
115 PARTITION "PART_20210829" VALUES LESS THAN (TO_DATE(' 2021-08-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
116 PARTITION "PART_20210830" VALUES LESS THAN (TO_DATE(' 2021-08-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
117 PARTITION "PART_20210831" VALUES LESS THAN (TO_DATE(' 2021-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE,
118 PARTITION "PART_MAX" VALUES LESS THAN (TO_DATE(' 3000-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE
119 )
120 /

Table created.

把数据insert 回去
`

``

SQL> insert into gwx.aopen select * from gwx.aopen_old;
insert into gwx.aopen select * from gwx.aopen_old
*
ERROR at line 1:
ORA-14400: inserted partition key does not map to any partition

14400, 00000, "inserted partition key does not map to any partition"
// *Cause: An attempt was made to insert a record into, a Range or Composite
// Range object, with a concatenated partition key that is beyond
// the concatenated partition bound list of the last partition -OR-
// An attempt was made to insert a record into a List object with
// a partition key that did not match the literal values specified
// for any of the partitions.
// *Action: Do not insert the key. Or, add a partition capable of accepting
// the key, Or add values matching the key to a partition specification

  

难道数据里面有大于分区表的分区,现在的心情就是微信表情中第6个。
(这个时候一些有经验的人就能想到,因为比0210601值小的会进入到最小的分区里,比20210831大的就会进入max分区里)

又改变了思路,我建了一个自动分区的分区表,就不相信你还报错。

 1 ```
 2 CREATE TABLE gwx.aopen
 3 ( "REQSEQ" VARCHAR2(32) NOT NULL ENABLE,
 4 "APPID" VARCHAR2(64),
 5 "APIID" VARCHAR2(64),
 6 "REQUESTIP" VARCHAR2(128),
 7 "BEGINTIME" VARCHAR2(32),
 8 "INTIME" DATE DEFAULT (sysdate),
 9 "OID" NUMBER(16,0),
10 "CHANNELID" VARCHAR2(64),
11 "VERSION" VARCHAR2(64),
12 "SERVICEID" VARCHAR2(64),
13 "RSPCONTENT" VARCHAR2(1024),
14 "SERVELAPSEPERIOD" VARCHAR2(32),
15 "ENDTIME" VARCHAR2(32),
16 "RETCODE" VARCHAR2(10),
17 "RETMSG" VARCHAR2(256),
18 "ROUTEVALUE" VARCHAR2(14),
19 "ROUTETYPE" NUMBER(1,0),
20 "AREACODE" NUMBER(5,0),
21 "SRCCODE" VARCHAR2(14),
22 "ISCACHE" NUMBER(1,0),
23 "H5PAGEID" VARCHAR2(32)
24 )
25 PARTITION BY RANGE ("INTIME") INTERVAL (INTERVAL '1' DAY) STORE IN ("SERVICE_MAIN_DAT")
26 (PARTITION "P0" VALUES LESS THAN (TO_DATE('2013-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION IMMEDIATE
27 ) ;
28 ```
 

心里想着这回不会报错了出乎意料的事还是发生了

QL> insert into gwx.aopen select * from gwx.aopen_old;
insert into gwx.aopen select * from gwx.aopen_old;
*
ERROR at line 1:
ORA-14300: partitioning key maps to a partition outside maximum permitted
number of partitions

还是报错了..........
这个错误我曾经需要过 (数据这一列INTIME上有空值)

SQL> select count(*) from gwx.aopen_old where INTIME is null ;

COUNT(*)

13


回顾一下 第二个错误,现在就很明显了!!!!!

posted on 2024-02-19 19:46  欣欣闹天下  阅读(7)  评论(0编辑  收藏  举报