Database Reference
In-Depth Information
6 ( partition part_1 tablespace p1,
7 partition part_2 tablespace p2
8 )
9 /
Table created.
the tablespaces in this example use Oracle Managed Files with the initialization parameter
DB_CREATE_FILE_DEST set to /u01/dbfile/ORA12CR1 .
Note
Next, we insert some data into the EMP table and then, using the partition-extended table name, inspect the
contents of each partition:
EODA@ORA12CR1> insert into emp select empno, ename from scott.emp;
14 rows created.
EODA@ORA12CR1> select * from emp partition(part_1);
EMPNO ENAME
---------- --------------------
7369 SMITH
7499 ALLEN
7654 MARTIN
7698 BLAKE
7782 CLARK
7839 KING
7876 ADAMS
7934 MILLER
8 rows selected.
EODA@ORA12CR1> select * from emp partition(part_2);
EMPNO ENAME
---------- --------------------
7521 WARD
7566 JONES
7788 SCOTT
7844 TURNER
7900 JAMES
7902 FORD
6 rows selected.
You should note that the data is somewhat randomly assigned. That is by design here. Using hash partitioning, we
are asking Oracle to randomly—but hopefully evenly—distribute our data across many partitions. We cannot control
the partition into which data goes; Oracle decides that based on hashing the hash key value itself. Later, when we look
at range and list partitioning, we'll see how we can control what partitions receive which data.
 
 
Search WWH ::




Custom Search