(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
Partition By Range (state)
( Partition lt_IN Values Less Than ('IN'),
Partition lt_MO Values Less Than ('MO'),
Partition lt_WY Values Less Than ('WY')
);
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
PARTITION BY RANGE (order_date) (
PARTITION old_orders VALUES LESS THAN (
to_date('01-JAN-1997','dd-mon-yyyy') )
STORAGE (INITIAL 500k NEXT 5K PCTINCREASE 0 )
TABLESPACE ts00,
PARTITION jan_orders VALUES LESS THAN (
to_date('01-FEB-1997','dd-mon-yyyy') )
STORAGE (INITIAL 250k NEXT 20k PCTINCREASE 10 )
TABLESPACE ts01,
PARTITION feb_orders VALUES LESS THAN (
to_date('01-MAR-1997','dd-mon-yyyy') )
STORAGE (INITIAL 100k NEXT 10k PCTINCREASE 10 )
TABLESPACE ts02 );
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
CREATE TABLE orders (
order# number(12)
, cust# number(9)
, order_year number(4)
, order_mon number(2)
, order_day number(2)
, order_price number(10,2) )
PARTITION BY RANGE (order_year, order_mon, order_day)
(PARTITION old_orders VALUES LESS THAN (1997, 01, 01)
,PARTITION jan_orders VALUES LESS THAN (1997, 02, 01)
,PARTITION feb_orders VALUES LESS THAN (1997, 03, 01)
,PARTITION mar_orders VALUES LESS THAN (1997, 04, 01));
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
CREATE TABLE cust
(cust_no INTEGER PRIMARY KEY
,lastname VARCHAR2(20) NOT NULL
,firstname VARCHAR2(15) NOT NULL
,area_code VARCHAR2(3)
,phone VARCHAR2(8) )
STORAGE (INITIAL 100K NEXT 100K)
PARTITION BY HASH(cust_no)
( PARTITION p1 TABLESPACE ts1, PARTITION p2 TABLESPACE ts2,
PARTITION p3 TABLESPACE ts3, PARTITION p4 TABLESPACE ts4);
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)

Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
CREATE TABLE orders
(order_id NUMBER(5) PRIMARY KEY,
order_date TIMESTAMP,
cust_id NUMBER(5),
order_total NUMBER(17,2),
warehouse_id NUMBER(5))
PARTITION BY LIST (warehouse_id)
(PARTITION EAST VALUES (1,5,10),
PARTITION MIDWEST VALUES (2,4,7,9),
PARTITION SOUTH VALUES (3,6),
PARTITION WEST VALUES (8,11,12,13,14));
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
ALTER TABLE orders
MODIFY PARTITION south
ADD VALUES (15);
ALTER TABLE orders
MODIFY PARTITION midwest
DROP VALUES (7);
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
PARTITION BY RANGE (region)
SUBPARTITION BY LIST (state)
(PARTITION new_england VALUES LESS THAN (2)
(SUBPARTITION ct VALUES ('CT'),
. . .
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)

Other Text:
(Examples or comments displayed on slide, if any).
SUBPARTITION TEMPLATE
(SUBPARTITION a TABLESPACE ts1,
SUBPARTITION b TABLESPACE ts2,
SUBPARTITION c TABLESPACE ts3,
SUBPARTITION d TABLESPACE ts4 )
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
create table ProjState
(proj_code varchar2(10)
,state char(2)
,city varchar2(30)
,primary key(proj_code, state) )
ORGANIZATION INDEX
INCLUDING state
overflow
Partition By hash (state)
partitions 50
store in (main_ts)
overflow store in (main_ts);
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
ALTER TABLE comedians DROP PARTITION p3
UPDATE GLOBAL INDEXES;
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
ALTER TABLE order_tab ENABLE ROW MOVEMENT;
ALTER TABLE order_tab DISABLE ROW MOVEMENT;
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
ALTER TABLE orders ADD PARTITION apr_orders
VALUES LESS THAN ( 1997,05, 01 )
TABLESPACE ts04;
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
ALTER TABLE orders DROP PARTITION old_orders;
DELETE FROM orders WHERE order_year < 1997;
--OR DELETE FROM orders PARTITION (old_orders)
ALTER TABLE orders DROP PARTITION old_orders;
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
ALTER TABLE order_tab
MERGE PARTITIONS q1, q2 INTO PARTITION q1ANDq2;
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
C:\>exp system/manager tables=dave.orders:old_orders
C:\>imp system/manager file=expdat.dmp fromuser=dave
tables=orders:old_orders ignore=y
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
ALTER TABLE ORDERS RENAME PARTITION old_orders
TO p1996_orders;
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SELECT partition_count, partitioning_key_count,
def_tablespace_name, def_pct_free
FROM sys.dba_part_tables
WHERE owner = 'DAVE'
AND table_name = 'ORDERS’;
PARTITION_COUNT PARTITIONING_KEY_COUNT DEF_TABLESPACE_NAME DEF_PCT_FREE
--------------- ---------------------- ------------------- ------------
4 3 USER_DATA 10
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SELECT column_name, column_position
FROM sys.dba_part_key_columns
WHERE owner = 'DAVE'
AND name = 'ORDERS';
ORDER BY 2;
COLUMN_NAME COLUMN_POSITION
------------------------------ ---------------
ORDER_YEAR 1
ORDER_MON 2
ORDER_DAY 3
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
select tablespace_name,
table_name,
partition_name,
high_value
from sys.dba_tab_partitions
order by partition_position;
TABLESPACE_NAME TABLE_NAME PARTITION_NAME HIGH_VALUE
------------------ ------------- ---------------- -------------
USER_DATA ORDERS OLD_ORDERS 1997, 01, 01
USER_DATA ORDERS JAN_ORDERS 1997, 02, 01
USER_DATA ORDERS FEB_ORDERS 1997, 03, 01
USER_DATA ORDERS MAR_ORDERS 1997, 04, 01
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SELECT *
FROM prod.orders PARTITION (3Q95);
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).