oracle list partition列表分割槽(一)
在上幾篇文章中學習了range partition及hash partition的相關知識;
本文測試list partition的用法:
內容包括:
1,建立語法
2,操作維護
3,操作限制
本文測試list partition的用法:
內容包括:
1,建立語法
2,操作維護
3,操作限制
----1,建立語法
---最簡樸建立list partition語法
SQL> create table t_list_partition(a int,b int)
2 partition by list(a)
3 (partition p1 values (1,2,3,4,5),
4 partition p2 values (6,7,8,9,10)
5 )
6 /
Table created.
-----2,操作維護
---測試default引數,須在表列中指定default值
SQL> create table t_list_partition(a int default 5,b int)
2 partition by list(a)
3 (partition p1 values (1,2,3,4,5),
4 partition p2 values (6,7,8,9,10),
5 partition p3 values (default)
6 )
7 /
Table created.
SQL> select * from t_list_partition;
no rows selected
SQL> insert into t_list_partition values(1,1);
1 row created.
SQL> insert into t_list_partition values(5,5);
1 row created.
SQL> insert into t_list_partition values(default,5);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t_list_partition;
A B
---------- ----------
1 1
5 5
5 5
---------- ----------
1 1
5 5
5 5
SQL> select * from t_list_partition partition(p1);
A B
---------- ----------
1 1
5 5
5 5
---------- ----------
1 1
5 5
5 5
---測試說明:如list partition分割槽的default與之前分割槽的列表值相同,則不會向此分割槽插入資料,優先插入到之前的列表分割槽
--oracle在建立時不會檢查分割槽各個值是相互邏輯矛盾
SQL> select * from t_list_partition partition(p3);
--oracle在建立時不會檢查分割槽各個值是相互邏輯矛盾
SQL> select * from t_list_partition partition(p3);
no rows selected
---查詢分割槽,還是3個分割槽
SQL> select table_name,partition_name,high_value from user_tab_partitions where
2 table_name='T_LIST_PARTITION';
TABLE_NAME
------------------------------------------------------------
PARTITION_NAME
------------------------------------------------------------
HIGH_VALUE
--------------------------------------------------------------------------------
------------------------------------------------------------
PARTITION_NAME
------------------------------------------------------------
HIGH_VALUE
--------------------------------------------------------------------------------
T_LIST_PARTITION
P1
1, 2, 3, 4, 5
P1
1, 2, 3, 4, 5
T_LIST_PARTITION
P2
6, 7, 8, 9, 10
P2
6, 7, 8, 9, 10
TABLE_NAME
------------------------------------------------------------
PARTITION_NAME
------------------------------------------------------------
HIGH_VALUE
--------------------------------------------------------------------------------
------------------------------------------------------------
PARTITION_NAME
------------------------------------------------------------
HIGH_VALUE
--------------------------------------------------------------------------------
T_LIST_PARTITION
P3
default
---用正確值指定default值
SQL> create table t_list_partition(a int default 11,b int)
2 partition by list(a)
3 (partition p1 values (1,2,3,4,5),
4 partition p2 values (6,7,8,9,10),
5 partition p3 values (default)
6 )
7 /
SQL> create table t_list_partition(a int default 11,b int)
2 partition by list(a)
3 (partition p1 values (1,2,3,4,5),
4 partition p2 values (6,7,8,9,10),
5 partition p3 values (default)
6 )
7 /
Table created.
SQL> select * from t_list_partition;
no rows selected
SQL> insert into t_list_partition values(1,1);
1 row created.
SQL> insert into t_list_partition values(6,1);
1 row created.
SQL> insert into t_list_partition values(default,1);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t_list_partition;
A B
---------- ----------
1 1
6 1
11 1
---------- ----------
1 1
6 1
11 1
SQL> select * from t_list_partition partition(p1);
A B
---------- ----------
1 1
---------- ----------
1 1
SQL> select * from t_list_partition partition(p2);
A B
---------- ----------
6 1
---------- ----------
6 1
---default值建立的記錄會對映到第3分割槽
SQL> select * from t_list_partition partition(p3);
SQL> select * from t_list_partition partition(p3);
A B
---------- ----------
11 1
---------- ----------
11 1
----如為列表值指定null,不再測試
----列出結果:null指在哪個分割槽,記錄對映到哪個分割槽中
-----3,操作限制
---列表分割槽分割槽列僅一個列
You can specify only one partitioning key column.
--分割槽列的型別僅為如下型別
The partitioning key column must be of type CHAR, NCHAR, VARCHAR2, NVARCHAR2, VARCHAR, NUMBER, FLOAT, DATE, TIMESTAMP, TIMESTAMP WITH LOCAL TIMEZONE, or RAW.
--分割槽列的型別僅為如下型別
The partitioning key column must be of type CHAR, NCHAR, VARCHAR2, NVARCHAR2, VARCHAR, NUMBER, FLOAT, DATE, TIMESTAMP, TIMESTAMP WITH LOCAL TIMEZONE, or RAW.
QL> create table t_list_partition(a int,b int)
2 partition by list(a,b)
3 (partition p1 values (1,2,3,4,5,null),
4 partition p2 values (6,7,8,9,10)
5 )
6 /
partition p1 values (1,2,3,4,5,null),
RROR at line 3:
RA-14304: List partitioning method expects a single partitioning column
RA-14304: List partitioning method expects a single partitioning column
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-752297/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle Partition 分割槽詳細總結Oracle
- 分割槽Partition
- Oracle查詢Interval partition分割槽表內資料Oracle
- 分割槽partition知識點
- Oracle分割槽表基礎運維-04列表分割槽Oracle運維
- Oracle分割槽表基礎運維-07增加分割槽(3列表分割槽)Oracle運維
- Spark學習——分割槽Partition數Spark
- Oracle分割槽表基礎運維-07增加分割槽(5RANGE_LIST)Oracle運維
- 分割槽函式Partition By的基本用法函式
- Kafka分割槽分配策略(Partition Assignment Strategy)Kafka
- oracle分割槽表和分割槽表exchangeOracle
- 分割槽函式partition by的基本用法【轉載】函式
- oracle分割槽表和非分割槽表exchangeOracle
- [oracle] expdp 匯出分割槽表的分割槽Oracle
- Oracle分割槽表基礎運維-07增加分割槽(2 HASH分割槽)Oracle運維
- 使用parted建立大分割槽時 mkpart Warning: The resulting partition is not properly
- Oracle分割槽表基礎運維-07增加分割槽(1範圍分割槽)Oracle運維
- ORACLE分割槽表梳理系列Oracle
- oracle 分割槽表move和包含分割槽表的lob moveOracle
- Oracle分割槽表基礎運維-09刪除分割槽Oracle運維
- Oracle分割槽表基礎運維-05組合分割槽Oracle運維
- Oracle分割槽表基礎運維-02範圍分割槽Oracle運維
- Oracle分割槽表基礎運維-03HASH分割槽Oracle運維
- Oracle12c:建立主分割槽、子分割槽,實現自動分割槽插入效果Oracle
- 86. Partition List
- MySQL全面瓦解29:使用Partition功能實現水平分割槽MySql
- 從10046看Oracle分割槽裁剪Oracle
- Oracle分割槽表基礎運維-06分割槽表索引Oracle運維索引
- Oracle分割槽表基礎運維-01分割槽表分類Oracle運維
- oracle分割槽交換(exchange)技術Oracle
- 對oracle分割槽表的理解整理Oracle
- oracle將表配置為分割槽表Oracle
- oracle 普通表-分割槽表改造流程Oracle
- Oracle SQL調優之分割槽表OracleSQL
- Oracle分割槽表基礎運維-07增加分割槽(4 RANGE_HASH)Oracle運維
- Oracle分割槽表基礎運維-07增加分割槽(6RANGE_RANGE)Oracle運維
- Oracle 12.2之後ALTER TABLE .. MODIFY轉換非分割槽表為分割槽表Oracle
- Oracle drop分割槽表單個分割槽無法透過閃回恢復Oracle
- oracle 線上重新定義,普通表改變分割槽表,分割槽表可以更改型別、分割槽欄位等Oracle型別