|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.javatools.db.AbstractDBObject
oracle.javatools.db.AbstractChildDBObject
oracle.javatools.db.ora.OracleTablePartitions
public class OracleTablePartitions
OracleTablePartitions encapsulate the properties of an Oracle table's partitions and subpartitions. The partitions and subpartitions can be defined individually or by models which the database uses to create individual (sub)partitions. Where both individual and model definitions are allowed, the individual definitions overide the model. For example the following DDL creates a table with 3 partitions defined by a model:
create table HASH1 ( C1 number , C2 number ) partition by hash(C1) partitions 3 store in ( USERS, EXAMPLE )
The following DDL creates a table with individually defined partitions:
create table HASH2 ( C1 number , C2 number ) partition by hash(C1) ( partition P1 tablespace USERS ,partition P2 tablespace EXAMPLE )
It isn't permissible to define both model and individual partitions, but it is permissible to define model and individual subpartitions :
create table RANGE_HASH1 ( C1 number , C2 number ) partition by range(C1) subpartition by hash(C2) subpartitions 2 store in (EXAMPLE) ( partition P100 values less than(100) ( subpartition ,subpartition RANGE_HASH1_SP1 ,subpartition RANGE_HASH1_SP2 ) ,partition P500 values less than(500) ,partition PMAX values less than(maxvalue) subpartitions 5 store in (USERS) )
In this example, partition P_100 has 3 individually defined subpartitions, partition P500 has 2 subpartitions defined by the subpartitions 2
model, and partition PMAX has 5 subpartitions defined by its own subpartitions model. The subpartition definitions within P100 and PMAX are known as partition level subpartitions. Instead of just defining how many subpartitions are created for partitions that don't define partition level subpartitions, a subpartition template can be defined instead :
create table RANGE_HASH2 ( C1 number , C2 number ) partition by range(C1) subpartition by hash(C2) subpartition template ( subpartition RANGE_HASH2_SP1 ,subpartition RANGE_HASH2_SP2 ) ( partition P100 values less than(100) ( subpartition ,subpartition RANGE_HASH2_SP3 ,subpartition RANGE_HASH2_SP4 ) ,partition P500 values less than(500) ,partition PMAX values less than(maxvalue) )
In this example, partitions P500 is allocated subpartitions called P500_RANGE_HASH2_SP1, and P500_RANGE_HASH2_SP2, and partition PMAX is allocated subpartitions PMAX_RANGE_HASH2_SP1, and PMAX_RANGE_HASH2_SP2.
If the table defines LOB or VARRAY columns, they may be further defined within an individual partition or subpartition :
create table RANGE_HASH3 ( C1 number , C2 number , C_CLOB clob , C_BLOB blob , C_VARRAY T_VARRAY ) partition by range(C1) subpartition by hash(C2) ( partition P100 values less than(100) lob(C_BLOB) store as RANGE_HASH3_P100_SEG1 ( subpartition RANGE_HASH3_SP1 lob(C_CLOB) store as RANGE_HASH3_SP1_SEG1( tablespace USERS) ,subpartition RANGE_HASH3_SP2 varray C_VARRAY store as lob RANGE_HASH3_SP2_SEG1 ) ,partition PMAX values less than(maxvalue) ( subpartition RANGE_HASH3_SP3 lob(C_CLOB) store as RANGE_HASH3_SP1_SEG3( tablespace USERS) varray C_VARRAY store as lob RANGE_HASH3_SP3_SEG1 ) )
The OracleTablePartitions class defines
A reference to an OracleTablePartitions object is stored on :
The usage of an OracleTablePartitions object is determined by its object type:
The distinction between SUBPARTITION and SUBPARTITION_TEMPLATE is necessary to distinguish the following cases :
subpartition by hash(<column list>) subpartitions <quantity> subpartition by hash(<column list>) subpartition template <quantity>
For consistency, all other usages that require subpartition template
to be included in the DDL should set an object type of SUBPARTITION_TEMPLATE.
The following example shows how OracleTablePartitions objects are used to model a table's partitions and subpartions. The example DDL is minimal; it doesn't include any of the properties that can be used to define individual (sub)partitions:
create table RANGE_HASH1 ( C1 number , C2 number ) partition by range(C1) subpartition by hash(C2) subpartitions 2 store as (EXAMPLE, USERS) ( partition P100 values less than(100) ( subpartition ,subpartition RANGE_HASH1_SP1 ,subpartition RANGE_HASH1_SP2 ) ,partition P500 values less than(500) ,partition PMAX values less than(maxvalue) subpartitions 5 store in (USERS) )
An OracleTablePartitions held on a Table object is required to define the table's partitions. Its PARTITION_TYPE is RANGE and its OBJECT_TYPE is PARTITION. Its COLUMNS contains C1, and its PARTITIONS references a TablePartition object for each of P100, P500 and PMAX. The HASH_QUANTITY and HASH_QUANTITY_TABLESPACES properties aren't used as it is a range partition. Since there are subpartitions, SUBPARTITION_MODEL references another OracleTablePartitions object that defines the subpartition model. This object's PARTITION_TYPE is HASH and OBJECT_TYPE is SUBPARTITION. If instead of the clause
subpartition by hash(C2) subpartitions 2 store as (USERS)
we had
subpartition by hash(C2) subpartition template 2
the OBJECT_TYPE would be SUBPARTITION_TEMPLATE. Its would also be SUBPARTITION_TEMPLATE, if instead of defining the number of templates we specified individual templates, e.g.
subpartition by hash(C2) subpartition template ( subpartition RANGE_HASH2_SP1 ,subpartition RANGE_HASH2_SP2 )
In all cases, the object's COLUMNS would contain C2 and SUBPARTITION_MODEL would be null as this object is the subpartition model (and subpartition model are only valid for RANGE PARTITIONs). In the 2 cases where the subpartition model defines the number of subpartitions, the HASH_QUANTITY property will contain that number. Additionaly, in the first case the names of the EXAMPLE and USERS tablespaces will be stored in the HASH_QUANTITY_TABLESPACES. The PARTITIONS property will be empty as individual subpartition templates aren't being defined. In contrast, when individual subpartition templates are defined, as in the example clause above, PARTITIONS will reference a TablePartition object for each of the templates (RANGE_HASH2_SP1, RANGE_HASH2_SP2).
In addition to the partitions and subpartiton model OracleTablePartitions objects, two more are required to define the partition level subpartitions of partitions P100 and PMAX. These OracleTablePartitions objects are held on the TablePartition objects that define P100 and PMAX. In both cases the PARTITION_TYPE is HASH, and OBJECT_TYPE is PARTITION_LEVEL_SUBPARTITION. COLUMNS is empty as columns cannot be specified for partition level subpartitions. For partition P100, HASH_QUANTITY, HASH_QUANTITY_TABLESPACES, and SUBPARTITION_MODEL are null or empty. Instead, PARTITIONS contains a TablePartition for each of its individual subpartitions. For partition PMAX, HASH_QUANTITY is 5 and HASH_QUANTITY_TABLESPACES contains USERS. SUBPARTITION_MODEL is null as this OracleTablePartitions object is defining partition level subpartitions, and PARTITIONS is empty because no individual sunpartitons are being defined.
DDL clauses when OBJECT_TYPE = PARTITION
DDL clauses when OBJECT_TYPE = SUBPARTITION
DDL clauses when OBJECT_TYPE = SUBPARTITION_TEMPLATE
DDL clauses when OBJECT_TYPE = PARTITION_LEVEL_SUBPARTITION
TablePartition
, LOBDescriptor
Nested Class Summary | |
---|---|
static class |
OracleTablePartitions.ObjectType |
static class |
OracleTablePartitions.PartitionType |
Nested classes/interfaces inherited from class oracle.javatools.db.AbstractDBObject |
---|
AbstractDBObject.ChildSupport |
Field Summary | |
---|---|
static java.lang.String |
KEY |
static java.lang.String |
TYPE |
Fields inherited from interface oracle.javatools.db.DBObject |
---|
COMMENT |
Constructor Summary | |
---|---|
OracleTablePartitions() |
|
OracleTablePartitions(OracleTablePartitions.PartitionType partitionType, OracleTablePartitions.ObjectType objectType) |
Method Summary | |
---|---|
void |
addHashQuantityTablespace(java.lang.String tablespaceName) Add a HASH_QUANTITY_TABLESPACE. |
void |
addPartition(TablePartition partition) Add an individual PARTITION, SUBPARTITION_TEMPLATE, or PARTITION_LEVEL_SUBPARTITION TablePartition object. |
void |
addPartitionColumn(DBObjectID partitionColumn) Add a (sub)partitioning column. |
void |
addPartitionColumn(DBObjectID partitionColumn, int atIndex) Add a (sub)partitioning column at the given index. |
TablePartition |
createPartition(java.lang.String name) Creates a TablePartition object of this.getPartitionType()+this.getObjectType and adds it to self. |
java.lang.Integer |
getHashQuantity() Return the HASH_QUANTITY. |
java.lang.String[] |
getHashQuantityTablespaces() Return an array of a HASH_QUANTITY_TABLESPACE. |
OracleTablePartitions.ObjectType |
getObjectType() |
DBObjectID[] |
getPartitionColumns() Return an array of (sub)partitioning columns. |
TablePartition[] |
getPartitions() Returns an array of individual PARTITION, SUBPARTITION_TEMPLATE, or PARTITION_LEVEL_SUBPARTITION TablePartition objects. |
OracleTablePartitions.PartitionType |
getPartitionType() |
OracleTablePartitions |
getSubpartitionModel() Returns the OracleTablePartitions object that defines the SUBPARTITION or SUBPARTITION_TEMPLATE model of a RANGE-HASH or RANGE-LIST composite partition. |
java.lang.String |
getType() Returns the type of this object. |
void |
removeHashQuantityTablespace(java.lang.String tablespaceName) Remove a HASH_QUANTITY_TABLESPACE. |
void |
removePartition(TablePartition partition) Remove an individual PARTITION, SUBPARTITION_TEMPLATE, or PARTITION_LEVEL_SUBPARTITION TablePartition object. |
void |
removePartitionColumn(DBObjectID partitionColumn) Remove a (sub)partitioning column. |
void |
setHashQuantity(java.lang.Integer hashQuantity) Set the HASH_QUANTITY. |
void |
setHashQuantityTablespaces(java.lang.String[] tablespaceNames) Replace the HASH_QUANTITY_TABLESPACE with new ones. |
void |
setObjectType(OracleTablePartitions.ObjectType objectType) Set OBJECT_TYPE as one of PARTITION, SUBPARTITION, SUBPARTITION_TEMPLATE, PARTITION_LEVEL_SUBPARTITION. |
void |
setPartitionColumns(DBObjectID[] partitionColumns) Replace the (sub)partitioning columns. |
void |
setPartitions(TablePartition[] partitions) Replace the individual PARTITION, SUBPARTITION_TEMPLATE, or PARTITION_LEVEL_SUBPARTITION TablePartition objects with new ones. |
void |
setPartitionType(OracleTablePartitions.PartitionType partitionType) Set PARTITION_TYPE as one of RANGE, HASH, LIST. |
void |
setSubpartitionModel(OracleTablePartitions subpartitionModel) Set the OracleTablePartitions object that defines the SUBPARTITION or SUBPARTITION_TEMPLATE model of a RANGE-HASH or RANGE-LIST composite partition. |
Methods inherited from class oracle.javatools.db.AbstractChildDBObject |
---|
copyToImpl, findParent, getParent, getProperty, setParent, setProperty |
Methods inherited from class oracle.javatools.db.AbstractDBObject |
---|
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyTo, equals, equalsImpl, findOwnedObject, findOwnedObject, findOwnedObject, getChildSupport, getID, getName, getOwnedObjects, getOwnedObjects, getOwnedObjectsImpl, getProperties, getProperty, getReferenceIDs, getReferenceIDsImpl, hashCode, includeOwnedObject, includesType, includesType, removeThisAsParent, replaceReferenceIDs, setID, setName, setProperties, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface oracle.javatools.db.DBObject |
---|
copyTo, copyTo, copyTo, findOwnedObject, findOwnedObject, getID, getName, getOwnedObjects, getOwnedObjects, getReferenceIDs, replaceReferenceIDs, setID, setName |
Methods inherited from interface oracle.javatools.util.DynamicPropertySet |
---|
getProperties, getProperty, setProperties |
Field Detail |
---|
public static final java.lang.String KEY
public static final java.lang.String TYPE
Constructor Detail |
---|
public OracleTablePartitions()
public OracleTablePartitions(OracleTablePartitions.PartitionType partitionType, OracleTablePartitions.ObjectType objectType)
Method Detail |
---|
public java.lang.String getType()
DBObject
public void setPartitionType(OracleTablePartitions.PartitionType partitionType)
partitionType
-public OracleTablePartitions.PartitionType getPartitionType()
public void setObjectType(OracleTablePartitions.ObjectType objectType)
objectType
-public OracleTablePartitions.ObjectType getObjectType()
public void setSubpartitionModel(OracleTablePartitions subpartitionModel)
subpartitionModel
-public OracleTablePartitions getSubpartitionModel()
getPartitions()
public void setPartitionColumns(DBObjectID[] partitionColumns)
partitionColumns
-public DBObjectID[] getPartitionColumns()
public void addPartitionColumn(DBObjectID partitionColumn)
partitionColumn
-public void addPartitionColumn(DBObjectID partitionColumn, int atIndex)
partitionColumn
-atIndex
-public void removePartitionColumn(DBObjectID partitionColumn)
public void setHashQuantity(java.lang.Integer hashQuantity)
hashQuantity
-public java.lang.Integer getHashQuantity()
public void setHashQuantityTablespaces(java.lang.String[] tablespaceNames)
tablespaceNames
-public void addHashQuantityTablespace(java.lang.String tablespaceName)
tablespaceName
-public void removeHashQuantityTablespace(java.lang.String tablespaceName)
tablespaceName
-public java.lang.String[] getHashQuantityTablespaces()
public void setPartitions(TablePartition[] partitions)
partitions
-public TablePartition[] getPartitions()
public void addPartition(TablePartition partition)
partition
-public void removePartition(TablePartition partition)
partition
-public TablePartition createPartition(java.lang.String name)
name
- : name of partition or null if unnamed
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |