1. 程式人生 > >Oracle數據庫分區相幹知識點

Oracle數據庫分區相幹知識點

兩個 用戶表 character 數據庫分區 創建 oracl interval 多個 sel

Partition Characteristics:
1.Partition Key;
2.Partitioning Strategies


Partitioning Strategies:
1. range
2. list
3. hash


創建一個有多個分區的表的實例:
create table testpt(tid int)
partition by range (tid)
(partition testpt_b10 values less than (10),
partition testpt_u9 values less than (MAXVALUE))


查看用戶表的分區
select * from user_tab_partitions




創建Interval Partitioning:
create table testpt(tid int)
partition by range (tid)
interval(5)
(partition testpt_b10 values less than (5),
partition testpt_u9 values less than (10))
當采用以間隔分區時,必須指定至少一個range partition



創建List Partitioning:
create table testpt(tid int)
partition by list (tid)
(partition testpt_odd values (1,3,5,7,9),
partition testpt_even values (2,4,6,8,0)
)


創建Hash Partitioning:
create table testpt(tid int)
partition by hash (tid)
partitions 3;


Reference Partitioning:
比如有orders 和line_items 兩個表,order_id 是 orders 的主鍵,是line_items 的外鍵。如果某個訂單保存到orders 中的某個partition,則該訂單的所有在 line_items 中的項也保存到該partition中。如果某個分區被增加到orders中,則該分區被自動被加到 line_items 中。








Oracle數據庫分區相幹知識點