SQL> alter session set NLS_DATE_FORMAT = 'dd-MON-yyyy';

세션이 변경되었습니다.

SQL> alter session set NLS_DATE_LANGUAGE = 'AMERICAN';

세션이 변경되었습니다.

SQL> @create_orders.sql
drop table order_items
           *
1행에 오류:
ORA-00942: 테이블 또는 뷰가 존재하지 않습니다


drop table orders
           *
1행에 오류:
ORA-00942: 테이블 또는 뷰가 존재하지 않습니다



테이블스페이스가 삭제되었습니다.


테이블스페이스가 생성되었습니다.


테이블스페이스가 삭제되었습니다.


테이블스페이스가 생성되었습니다.


테이블이 생성되었습니다.


테이블이 변경되었습니다.

SQL> @create_order_items;

테이블이 생성되었습니다.

SQL> @query_dict_1
SQL>
SQL> set echo off
SQL>
SQL> select table_name, partitioning_type, ref_ptn_constraint_name
  2  from user_part_tables
  3  where table_name in ('ORDERS','ORDER_ITEMS');

TABLE_NAME                     PARTITION REF_PTN_CONSTRAINT_NAME
------------------------------ --------- ------------------------------
ORDERS                         RANGE
ORDER_ITEMS                    REFERENCE ORDER_ITEMS_ORDERS_FK

2 개의 행이 선택되었습니다.

SQL>
SQL> select table_name, partition_name, high_value
  2  from user_tab_partitions
  3  where table_name in ('ORDERS','ORDER_ITEMS')
  4  order by partition_position, table_name;

TABLE_NAME                     PARTITION_NAME            HIGH_VALUE
------------------------------ ------------------------- -------------------------------------------------------------------------------------
ORDERS                         P_BEFORE_JAN_2006         TO_DATE(' 2006-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_BEFORE_JAN_2006
ORDERS                         P_2006_JAN                TO_DATE(' 2006-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_JAN
ORDERS                         P_2006_FEB                TO_DATE(' 2006-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_FEB
ORDERS                         P_2006_MAR                TO_DATE(' 2006-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_MAR
ORDERS                         P_2006_APR                TO_DATE(' 2006-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_APR
ORDERS                         P_2006_MAY                TO_DATE(' 2006-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_MAY
ORDERS                         P_2006_JUN                TO_DATE(' 2006-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_JUN
ORDERS                         P_2006_JUL                TO_DATE(' 2006-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_JUL
ORDERS                         P_2006_AUG                TO_DATE(' 2006-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_AUG
ORDERS                         P_2006_SEP                TO_DATE(' 2006-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_SEP
ORDERS                         P_2006_OCT                TO_DATE(' 2006-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_OCT
ORDERS                         P_2006_NOV                TO_DATE(' 2006-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_NOV
ORDERS                         P_2006_DEC                TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_DEC

26 개의 행이 선택되었습니다.

SQL>
SQL> select up.table_name, up.partitioning_type, uc.table_name ref_table
  2  from user_part_tables up,
  3  (select r.table_name, r.constraint_name from user_constraints uc, user_constraints r
  4  where uc.constraint_name=r.constraint_name and uc.owner=r.owner) uc
  5  where up.ref_ptn_constraint_name = uc.constraint_name(+)
  6  and up.table_name in ('ORDERS','ORDER_ITEMS');

TABLE_NAME                     PARTITION REF_TABLE
------------------------------ --------- ------------------------------
ORDER_ITEMS                    REFERENCE ORDER_ITEMS
ORDERS                         RANGE

2 개의 행이 선택되었습니다.

SQL> @insert_orders.sql
SQL>
SQL>
SQL> set echo off

1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


1 개의 행이 만들어졌습니다.


커밋이 완료되었습니다.

SQL> @show_data_placement.sql
SQL> set feedback on

SQL> alter session set nls_date_format='dd-mon-yyyy' ;

세션이 변경되었습니다.

SQL> select order_id, order_date
  2  from orders partition (p_2006_oct)
  3  /

  ORDER_ID ORDER_DATE
---------- --------------
         1 23-oct-2006
         2 24-oct-2006
         3 25-oct-2006
         4 26-oct-2006

4 개의 행이 선택되었습니다.

SQL>
SQL> select oi.order_id, o.order_date, sum(oi.sales_amount) sum_sales
  2  from orders o
  3  , order_items partition (p_2006_oct) oi
  4  where o.order_id = oi.order_id
  5  group by oi.order_id, o.order_date
  6  order by oi.order_id
  7  /

  ORDER_ID ORDER_DATE      SUM_SALES
---------- -------------- ----------
         1 23-oct-2006         22400
         2 24-oct-2006         10570
         3 25-oct-2006          1200
         4 26-oct-2006        129680

4 개의 행이 선택되었습니다.

SQL> @Show_plan.sql
SQL> ALTER SESSION SET "_parallel_broadcast_enabled"=FALSE;

세션이 변경되었습니다.

SQL>
SQL> set echo off
SQL>
SQL> -- the query
SQL> explain plan for
  2  select /*+ use_hash(o,oi) */ o.order_id
  3  , o.order_date
  4  , sum(oi.quantity) sum_quantity
  5  , sum(oi.sales_amount) sum_sales
  6  from orders o
  7  , order_items oi
  8  where o.order_id = oi.order_id
  9  and o.order_date between to_date('01-SEP-2006','DD-MON-YYYY')
 10  and to_date('12-DEC-2006','DD-MON-YYYY')
 11  group by o.order_id
 12  , o.order_date
 13  order by o.order_date
 14  /

해석되었습니다.

SQL>
SQL> -- the execution plan
SQL> select * from table(dbms_xplan.display)
  2  /

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 613304314
------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                                        | Name        | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Di
------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                                 |             |     6 |   366 |     5  (40)| 00:00:01 |       |       |        |      |
|   1 |  PX COORDINATOR                                  |             |       |       |            |          |       |       |        |      |
|   2 |   PX SEND QC (ORDER)                             | :TQ10005    |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,05 | P->S | QC (O
|   3 |    SORT ORDER BY                                 |             |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,05 | PCWP |
|   4 |     PX RECEIVE                                   |             |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,05 | PCWP |
|   5 |      PX SEND RANGE                               | :TQ10004    |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,04 | P->P | RANGE
|   6 |       SORT GROUP BY                              |             |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,04 | PCWP |
|   7 |        PX RECEIVE                                |             |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,04 | PCWP |
|   8 |         PX SEND HASH                             | :TQ10003    |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,03 | P->P | HASH
|   9 |          HASH GROUP BY                           |             |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,03 | PCWP |
|  10 |           MERGE JOIN                             |             |     6 |   366 |     5  (40)| 00:00:01 |       |       |  Q1,03 | PCWP |
|  11 |            SORT JOIN                             |             |     5 |   110 |     1   (0)| 00:00:01 |       |       |  Q1,03 | PCWP |
|  12 |             BUFFER SORT                          |             |       |       |            |          |       |       |  Q1,03 | PCWC |
|  13 |              PX RECEIVE                          |             |     5 |   110 |     1   (0)| 00:00:01 |       |       |  Q1,03 | PCWP |
|  14 |               PX SEND HASH                       | :TQ10000    |     5 |   110 |     1   (0)| 00:00:01 |       |       |        | S->P | HASH
|* 15 |                TABLE ACCESS BY GLOBAL INDEX ROWID| ORDERS      |     5 |   110 |     1   (0)| 00:00:01 | ROWID | ROWID |        |      |
|  16 |                 INDEX FULL SCAN                  | ORDERS_PK   |    16 |       |     1   (0)| 00:00:01 |       |       |        |      |
|* 17 |            SORT JOIN                             |             |    19 |   741 |     4  (50)| 00:00:01 |       |       |  Q1,03 | PCWP |
|  18 |             PX RECEIVE                           |             |    19 |   741 |     3  (34)| 00:00:01 |       |       |  Q1,03 | PCWP |
|  19 |              PX SEND HASH                        | :TQ10002    |    19 |   741 |     3  (34)| 00:00:01 |       |       |  Q1,02 | P->P | HASH
|  20 |               VIEW                               | VW_GBC_5    |    19 |   741 |     3  (34)| 00:00:01 |       |       |  Q1,02 | PCWP |
|  21 |                HASH GROUP BY                     |             |    19 |   741 |     3  (34)| 00:00:01 |       |       |  Q1,02 | PCWP |
|  22 |                 PX RECEIVE                       |             |    19 |   741 |     3  (34)| 00:00:01 |       |       |  Q1,02 | PCWP |
|  23 |                  PX SEND HASH                    | :TQ10001    |    19 |   741 |     3  (34)| 00:00:01 |       |       |  Q1,01 | P->P | HASH
|  24 |                   HASH GROUP BY                  |             |    19 |   741 |     3  (34)| 00:00:01 |       |       |  Q1,01 | PCWP |
|  25 |                    PX BLOCK ITERATOR             |             |    19 |   741 |     2   (0)| 00:00:01 |     1 |    13 |  Q1,01 | PCWC |
|  26 |                     TABLE ACCESS FULL            | ORDER_ITEMS |    19 |   741 |     2   (0)| 00:00:01 |     1 |    13 |  Q1,01 | PCWP |
------------------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
  15 - filter("O"."ORDER_DATE">=TO_DATE(' 2006-09-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "O"."ORDER_DATE"<=TO_DATE(' 2006-12-12 00:00:00',
              'syyyy-mm-dd hh24:mi:ss'))
  17 - access("O"."ORDER_ID"="ITEM_1")
       filter("O"."ORDER_ID"="ITEM_1")

Note
-----
   - dynamic sampling used for this statement (level=2)

45 개의 행이 선택되었습니다.

SQL> @Show_plan.sql
SQL> ALTER SESSION SET "_parallel_broadcast_enabled"=FALSE;

세션이 변경되었습니다.

SQL>
SQL> set echo off
SQL>
SQL> -- the query
SQL> explain plan for
  2  select /*+ full(o) use_hash(o,oi) */ o.order_id
  3  , o.order_date
  4  , sum(oi.quantity) sum_quantity
  5  , sum(oi.sales_amount) sum_sales
  6  from orders o
  7  , order_items oi
  8  where o.order_id = oi.order_id
  9  and o.order_date between to_date('01-SEP-2006','DD-MON-YYYY')
 10  and to_date('12-DEC-2006','DD-MON-YYYY')
 11  group by o.order_id
 12  , o.order_date
 13  order by o.order_date
 14  /

해석되었습니다.

SQL>
SQL> -- the execution plan
SQL> select * from table(dbms_xplan.display)
  2  /

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------
Plan hash value: 2331947017

----------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                         | Name        | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
----------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                  |             |    19 |  1159 |     6  (34)| 00:00:01 |    |  |        |      |            |
|   1 |  PX COORDINATOR                   |             |       |       |            |          |    |  |        |      |            |
|   2 |   PX SEND QC (ORDER)              | :TQ10001    |    19 |  1159 |     6  (34)| 00:00:01 |    |  |  Q1,01 | P->S | QC (ORDER) |
|   3 |    SORT GROUP BY                  |             |    19 |  1159 |     6  (34)| 00:00:01 |    |  |  Q1,01 | PCWP |            |
|   4 |     PX RECEIVE                    |             |    19 |  1159 |     6  (34)| 00:00:01 |    |  |  Q1,01 | PCWP |            |
|   5 |      PX SEND RANGE                | :TQ10000    |    19 |  1159 |     6  (34)| 00:00:01 |    |  |  Q1,00 | P->P | RANGE      |
|   6 |       HASH GROUP BY               |             |    19 |  1159 |     6  (34)| 00:00:01 |    |  |  Q1,00 | PCWP |            |
|   7 |        PX PARTITION RANGE ITERATOR|             |    19 |  1159 |     5  (20)| 00:00:01 |    10 |    13 |  Q1,00 | PCWC |            |
|*  8 |         HASH JOIN                 |             |    19 |  1159 |     5  (20)| 00:00:01 |    |  |  Q1,00 | PCWP |            |
|*  9 |          TABLE ACCESS FULL        | ORDERS      |     5 |   110 |     2   (0)| 00:00:01 |    10 |    13 |  Q1,00 | PCWP |            |
|  10 |          TABLE ACCESS FULL        | ORDER_ITEMS |    19 |   741 |     2   (0)| 00:00:01 |    10 |    13 |  Q1,00 | PCWP |            |
----------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   8 - access("O"."ORDER_ID"="OI"."ORDER_ID")
   9 - filter("O"."ORDER_DATE"<=TO_DATE(' 2006-12-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))

Note
-----
   - dynamic sampling used for this statement (level=2)

27 개의 행이 선택되었습니다.


SQL> @drop_partition.sql
SQL> set echo off
SQL> alter table orders drop partition p_before_jan_2006 update global indexes
  2  ;

테이블이 변경되었습니다.

SQL> @Query_dict_2.sql
SQL> set echo off
SQL> select table_name, partition_name, high_value
  2  from user_tab_partitions
  3  where table_name in ('ORDERS','ORDER_ITEMS')
  4  order by partition_position, table_name
  5  /

TABLE_NAME                     PARTITION_NAME            HIGH_VALUE
------------------------------ ------------------------- -------------------------------------------------------------------------------------
ORDERS                         P_2006_JAN                TO_DATE(' 2006-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_JAN
ORDERS                         P_2006_FEB                TO_DATE(' 2006-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_FEB
ORDERS                         P_2006_MAR                TO_DATE(' 2006-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_MAR
ORDERS                         P_2006_APR                TO_DATE(' 2006-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_APR
ORDERS                         P_2006_MAY                TO_DATE(' 2006-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_MAY
ORDERS                         P_2006_JUN                TO_DATE(' 2006-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_JUN
ORDERS                         P_2006_JUL                TO_DATE(' 2006-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_JUL
ORDERS                         P_2006_AUG                TO_DATE(' 2006-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_AUG
ORDERS                         P_2006_SEP                TO_DATE(' 2006-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_SEP
ORDERS                         P_2006_OCT                TO_DATE(' 2006-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_OCT
ORDERS                         P_2006_NOV                TO_DATE(' 2006-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_NOV
ORDERS                         P_2006_DEC                TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
ORDER_ITEMS                    P_2006_DEC

24 개의 행이 선택되었습니다.

SQL>
SQL> @add_partition.sql
SQL>
SQL> set echo off
SQL> set feedback on
SQL>
SQL> -- manageability aspects and flexibility to combine PMOPs but still have the flexibility to place various partitions
SQL> alter table orders
  2  add partition p2007_01 values less than (to_date('01-feb-2007','dd-mon-yyyy'))
  3  tablespace x;

테이블이 변경되었습니다.

SQL>
SQL> -- show co-location of partitions for parent and child
SQL> select table_name, partition_name, tablespace_name, high_value
  2  from user_tab_partitions where table_name in ('ORDERS','ORDER_ITEMS')
  3  order by partition_position, table_name;

TABLE_NAME                     PARTITION_NAME            TABLESPACE_NAME                HIGH_VALUE
------------------------------ ------------------------- ------------------------------ --------------------------------------------------------------
----------------
ORDERS                         P_2006_JAN                USERS                          TO_DATE(' 2006-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_JAN                USERS
ORDERS                         P_2006_FEB                USERS                          TO_DATE(' 2006-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_FEB                USERS
ORDERS                         P_2006_MAR                USERS                          TO_DATE(' 2006-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_MAR                USERS
ORDERS                         P_2006_APR                USERS                          TO_DATE(' 2006-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_APR                USERS
ORDERS                         P_2006_MAY                USERS                          TO_DATE(' 2006-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_MAY                USERS
ORDERS                         P_2006_JUN                USERS                          TO_DATE(' 2006-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_JUN                USERS
ORDERS                         P_2006_JUL                USERS                          TO_DATE(' 2006-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_JUL                USERS
ORDERS                         P_2006_AUG                USERS                          TO_DATE(' 2006-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_AUG                USERS
ORDERS                         P_2006_SEP                USERS                          TO_DATE(' 2006-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_SEP                USERS
ORDERS                         P_2006_OCT                USERS                          TO_DATE(' 2006-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_OCT                USERS
ORDERS                         P_2006_NOV                USERS                          TO_DATE(' 2006-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_NOV                USERS
ORDERS                         P_2006_DEC                USERS                          TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_DEC                USERS
ORDERS                         P2007_01                  X                              TO_DATE(' 2007-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P2007_01                  X

26 개의 행이 선택되었습니다.

SQL>
SQL> -- second PMOP
SQL> alter table orders
  2  add partition p2007_02 values less than (to_date('01-mar-2007','dd-mon-yyyy'))
  3  tablespace x
  4  dependent tables ( order_items (partition foo tablespace y));

테이블이 변경되었습니다.

SQL>
SQL> select table_name, partition_name, tablespace_name, high_value
  2  from user_tab_partitions
  3  where table_name in ('ORDERS','ORDER_ITEMS') order by partition_position, table_name;

TABLE_NAME                     PARTITION_NAME            TABLESPACE_NAME                HIGH_VALUE
------------------------------ ------------------------- ------------------------------ --------------------------------------------------------------
----------------
ORDERS                         P_2006_JAN                USERS                          TO_DATE(' 2006-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_JAN                USERS
ORDERS                         P_2006_FEB                USERS                          TO_DATE(' 2006-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_FEB                USERS
ORDERS                         P_2006_MAR                USERS                          TO_DATE(' 2006-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_MAR                USERS
ORDERS                         P_2006_APR                USERS                          TO_DATE(' 2006-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_APR                USERS
ORDERS                         P_2006_MAY                USERS                          TO_DATE(' 2006-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_MAY                USERS
ORDERS                         P_2006_JUN                USERS                          TO_DATE(' 2006-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_JUN                USERS
ORDERS                         P_2006_JUL                USERS                          TO_DATE(' 2006-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_JUL                USERS
ORDERS                         P_2006_AUG                USERS                          TO_DATE(' 2006-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_AUG                USERS
ORDERS                         P_2006_SEP                USERS                          TO_DATE(' 2006-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_SEP                USERS
ORDERS                         P_2006_OCT                USERS                          TO_DATE(' 2006-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_OCT                USERS
ORDERS                         P_2006_NOV                USERS                          TO_DATE(' 2006-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_NOV                USERS
ORDERS                         P_2006_DEC                USERS                          TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P_2006_DEC                USERS
ORDERS                         P2007_01                  X                              TO_DATE(' 2007-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    P2007_01                  X
ORDERS                         P2007_02                  X                              TO_DATE(' 2007-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS
AR=GREGORIAN')
ORDER_ITEMS                    FOO                       Y

28 개의 행이 선택되었습니다.

SQL> @cleanup_1
SQL> set echo off
SQL> set feedback on
SQL>
SQL> -- cleanup
SQL> alter table orders drop partition p2007_01;

테이블이 변경되었습니다.

SQL> alter table orders drop partition p2007_02;

테이블이 변경되었습니다.

SQL> drop tablespace x;

테이블스페이스가 삭제되었습니다.

SQL> drop tablespace y;

테이블스페이스가 삭제되었습니다.

SQL>