ORA-14758: Last partition in the range section cannot be dropped
今天發現oracle11g中用oracle自動建立分割槽的新功能後,刪除舊分割槽報ORA-14758: Last partition in the range section cannot be dropped錯誤。
oracle對此錯誤的解釋是:
ORA-14758: Last partition in the range section cannot be dropped實驗如下:
1.建立自動分割槽的表:
SQL> create table TB_DYNA_TABLE
(
NUM NUMBER,
NAME VARCHAR2(30),
CRT_TIME DATE not null
)
partition by range (CRT_TIME)
interval(numtodsinterval(1,'DAY'))
(PARTITION P20120919 VALUES LESS THAN (TO_DATE(' 2012-09-20 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')));
根據建立時間按天建立分割槽表。
插入幾條資料:
SQL>
SQL> INSERT INTO TB_DYNA_TABLE(NUM,NAME,CRT_TIME)
2 VALUES(1,'DONGCS1',TO_DATE('2012-09-15','YYYY-MM-DD'));
1 row inserted
SQL> INSERT INTO TB_DYNA_TABLE(NUM,NAME,CRT_TIME)
2 VALUES(2,'DONGCS2',TO_DATE('2012-09-20','YYYY-MM-DD'));
1 row inserted
SQL> INSERT INTO TB_DYNA_TABLE(NUM,NAME,CRT_TIME)
2 VALUES(3,'DONGCS3',TO_DATE('2012-09-21','YYYY-MM-DD'));
1 row inserted
SQL> INSERT INTO TB_DYNA_TABLE(NUM,NAME,CRT_TIME)
2 VALUES(4,'DONGCS4',TO_DATE('2012-09-22','YYYY-MM-DD'));
1 row inserted
SQL> INSERT INTO TB_DYNA_TABLE(NUM,NAME,CRT_TIME)
2 VALUES(5,'DONGCS5',TO_DATE('2012-09-23','YYYY-MM-DD'));
1 row inserted
SQL> INSERT INTO TB_DYNA_TABLE(NUM,NAME,CRT_TIME)
2 VALUES(6,'DONGCS6',TO_DATE('2012-09-24','YYYY-MM-DD'));
1 row inserted
SQL> commit;
Commit complete
查詢資料情況:
SQL> select * from TB_DYNA_TABLE;
NUM NAME CRT_TIME
---------- ------------------------------ -----------
1 DONGCS1 2012-9-15
2 DONGCS2 2012-9-20
3 DONGCS3 2012-9-21
4 DONGCS4 2012-9-22
5 DONGCS5 2012-9-23
6 DONGCS6 2012-9-24
6 rows selected
查詢表的分割槽資訊:
SQL> SELECT t.table_name,t.partition_name,t.partition_position FROM User_Tab_Partitions t WHERE t.table_name='TB_DYNA_TABLE';
TABLE_NAME PARTITION_NAME PARTITION_POSITION
------------------------------ ------------------------------ ------------------
TB_DYNA_TABLE P20120919 1
TB_DYNA_TABLE SYS_P61 2
TB_DYNA_TABLE SYS_P63 3
TB_DYNA_TABLE SYS_P62 4
TB_DYNA_TABLE SYS_P65 5
TB_DYNA_TABLE SYS_P64 6
6 rows selected
刪除第一個分割槽看看:
SQL> alter table TB_DYNA_TABLE drop partition P20120919;
alter table TB_DYNA_TABLE drop partition P20120919
ORA-14758: Last partition in the range section cannot be dropped
看來第一個分割槽刪不了。
刪除其他分割槽看看:
SQL> alter table TB_DYNA_TABLE drop partition SYS_P61;
Table altered
SQL> alter table TB_DYNA_TABLE drop partition SYS_P63;
Table altered
其他分割槽可以刪除。
查詢表的分割槽資訊:
SQL> SELECT t.table_name,t.partition_name,t.partition_position FROM User_Tab_Partitions t WHERE t.table_name='TB_DYNA_TABLE';
TABLE_NAME PARTITION_NAME PARTITION_POSITION
------------------------------ ------------------------------ ------------------
TB_DYNA_TABLE P20120919 1
TB_DYNA_TABLE SYS_P62 2
TB_DYNA_TABLE SYS_P65 3
TB_DYNA_TABLE SYS_P64 4
總結:
1.建表時需要指定第一個初始化的分割槽
2.插入資料後,分割槽根據插入的資料自動分割槽了;
3.刪除第一個分割槽刪除不了,只能刪除之後的分割槽。
另外還需注意:如果表有索引且不是分割槽索引,刪除分割槽後(分割槽裡面且有資料),那麼需要重建索引。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12129601/viewspace-744832/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORA-14257: cannot move partition other than a Range or Hash partition
- B. Range and Partition
- 深入解析partition-range分割槽
- 【實驗】【PARTITION】RANGE分割槽建立
- oracle composite partition組合分割槽_composite partition rangeOracle
- 實驗】【PARTITION】RANGE分割槽建立【轉】
- 【實驗】【PARTITION】RANGE分割槽表截斷表分割槽(Truncate Partition)
- 【實驗】【PARTITION】RANGE分割槽表移動表分割槽(Move Partition)
- ORA-14074: partition bound must collate higher than that of the last partitionAST
- 【實驗】【PARTITION】RANGE分割槽表重新命名錶分割槽(Rename Partition)
- ORACLE 範圍分割槽 partition-range分割槽Oracle
- 【實驗】【PARTITION】RANGE分割槽表合併分割槽
- 【實驗】【PARTITION】RANGE分割槽表增加分割槽
- 【實驗】【PARTITION】RANGE分割槽表刪除分割槽
- Error: cannot fetch last explain plan from PLAN_TABLEErrorASTAI
- You cannot change a partition into an extended one or vice versa Delete it firstdelete
- MySQL案例01:Last_SQL_Errno: 1755 Cannot execute the current event group in the parallel modeMySqlASTParallel
- partition table and partition indexIndex
- PARTITION partition01
- PARTITION partition02
- PARTITION partition04
- 【實驗】【PARTITION】RANGE分割槽表未指定maxvalue分割槽將無法插入相關資料
- oracle全文索引之SECTION GROUP_6_PATH_SECTION_GROUPOracle索引
- oracle全文索引之SECTION GROUP_5_AUTO_SECTION_GROUPOracle索引
- oracle全文索引之SECTION GROUP_4_XML_SECTION_GROUPOracle索引XML
- oracle全文索引之SECTION GROUP_3_HTML_SECTION_GROUPOracle索引HTML
- oracle全文索引之SECTION GROUP_2_BASIC_SECTION_GROUPOracle索引
- oracle全文索引之SECTION GROUP_1_NULL_SECTION_GROUPOracle索引Null
- rust-quiz:019-dropped-by-underscore.rsRustUI
- HTML <section> 標籤HTML
- jQuery last()jQueryAST
- Last WinnerAST
- Last danceAST
- Pruning、Reference Partition、Exchange Partition
- partition timestamp(0) not use partition
- <section>與<article> 區別
- Oracle AWR Top SQL sectionOracleSQL
- 7.121 LASTAST