记一次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
```
回顾一下 第二个错误,现在就很明显了!!!!!
记一次oracle单表改分区表 一波三折的更多相关文章
- Oracle大表改为分区表及表空间切换方案
Oracle大表改为分区表及表空间切换方案 一. 背景 由于之前数据库表和索引放在一个表空间导致表空间数据文件增长太快,文件数量即将达到Oracle表空间的限制,需要对表(没有分 ...
- Oracle单表的简单查询
Oracle单表的简单查询 查看表结构 desc emp; 查询所有列 Select * from emp; 查找所以部门编号(查指定的列) select deptnofrom emp; 查找编号不同 ...
- Oracle单表的复杂查询
Oracle单表的复杂查询 select avg(sal),max(sal),deptnofrom empgroupby deptno; orderby deptno; 查询工资高于500或者是岗位为 ...
- Oracle单表去重复(二)
Oracle单表去重 去重有两层含义,一:是记录完全一样.二:是符合一定条件的认为是重复. 根据表的数量,去重可划分为:单表去重和多表关联去重. 对于去重,一般最容易想到的是用distinct,而 ...
- Oracle单表去重复(一)
去重有两层含义,一:是记录完全一样:二:是符合一定条件的认为是重复. 根据表的数量,去重可划分为:单表去重和多表关联去重. 对于去重,一般最容易想到的是用distinct,而distinct只能对 ...
- Oracle 单表选择率
听了猫大师的课,对Oracle CBO又加深了一步理解: 单表选择率: selectivity=1/ndv*a4nulls ocard来自dba_tables.num_rows ndv 来自dba_t ...
- Oracle - 单表查询相关
-- 单表查询 -- 查询表的所有数据, *代表所有 -- select * from [表名]; -- 查询表中指定字段的值 -- select [字段1], [字段2] ... from [表名] ...
- oracle move表空间(分区表,索引)
1.修改分区表分区表空间 SELECT 'ALTER TABLE ' || table_owner || '.' || TABLE_NAME || ' MOVE PARTITION ' || PART ...
- ORACLE单表理论最大记录数
不考虑硬件诸如内存,存储等硬件的限制. 一张表理论能存储多少条记录呢? 假设: 一个tablespace中包含1022个datafiles, 单个datafiles的最大是32G 假设每个block是 ...
- oracle普通表转分区表(在线重定义方式)
1.1.TAB_TAOBAO_BILL 1.1.1检查下这张表是否可以在线重定义,无报错表示可以,报错会给出错误信息: exec dbms_redefinition.can_redef_table(' ...
随机推荐
- 使用NPOI core插入图片
闲的无聊,封装一个NPOI core插入图片,下面贴上代码,有注释,我就不讲解了 public class ExcelHelper { /// <summary> /// excel插入图 ...
- python -m pip install --upgrade pip报No module named pip解决方法
解决方法: 1. python -m ensurepip 2. python -m pip install --upgrade pip 注意:添加pip环境变量 在python安装目录下搜索pip3或 ...
- 使用pip命令安装库时提示Could not build wheels for six, since package 'wheel' is not installed
在使用pip命令安装库时提示Could not build wheels for six, since package 'wheel' is not installed 解决以上问题可用 pip in ...
- ArcObjects SDK开发 022 开发框架搭建-FrameWorkUI包设计
1.CommandUIs部分 这部分主要是定义承载Command和Tool的具体UI.如下图所示. 以CommandUI结尾的这几个类都是继承了Framework.Engine里面的ICommandU ...
- Js/Jq 截图并上传
今天想做一个 Js + Jq 截取网页图并上传到后端,经过一番折腾最终达到了效果. 1·首先需要用到一个非常强大的外部依赖库 html2canvas html2canvas 官网:html2canva ...
- 【力扣】剑指 Offer II 092. 翻转字符
题目 解题思路 一个很暴力的想法,在满足单调递增的前提下,使每一位分别取 1 或 0,去看看哪个结果小. 递归函数定义int dp(StringBuilder sb, int ind, int pre ...
- 腾讯微信开源数据库PhxSQL简单部署记录
1.建立文件夹与互信关系 [root@mysql-100 ~]# mkdir -p /app/soft/phxsql [root@mysql-100 phxsql]# ssh-keygen -t rs ...
- Java 进阶P-7.4+P-7.5
JTable 用JTbale类可以以表格的形式显示和编辑数据. JTable类的对象并不存储数据,他只是数据的表现. 表格是 Swing 新增加的组件,主要功能是把数据以二维表格的形式显示出来,并且允 ...
- Docker修改已有容器的端口映射
Docker修改已有容器的端口映射 背景 拉取了jenkins的镜像,启动容器的时候端口就映射了8080,但这个演示环境要用到jenkins node,其中默认的代理端口是50000.漏了,就想着能否 ...
- 嵌入式Linux—文件IO
文件IO 在 Linux 系统中,一切都是" 文件":普通文件.驱动程序.网络通信等等.所有的操作,都是通过"文件 IO"来进行的.所以,很有必要掌握文件操作的 ...