Use horizontally partitioned replication to divide the rows of a table into separate processing streams. You can use horizontally partitioned replication to:
The following are guidelines to follow if you are considering a configuration that combines horizontally partitioned replication with vertically partitioned or full-table replication.
You can combine horizontally partitioned and vertically partitioned replication for maximum control over which information is distributed, and to where.
For example:
To implement horizontally partitioned replication, you do the following:
A partition is a subset of the rows in a table that you want to replicate. To create a partition, you specify a column condition or a hash value, depending on your objectives. The following explains these concepts.
Column condition: A column condition is based on a standard WHERE clause. Use one or more column conditions for the following purposes:
Use multiple column conditions to partition the rows of a table so that each set of rows replicates to a different target. For example: replicate changes where the value of the REGION column is EAST to one location and rows where REGION is WEST to a different location.
Use multiple column conditions to divide the rows of a table into parallel processing streams (parallel Export-Import-Post streams) for faster posting to the target table. For example, you can improve the flow of replication to a heavily updated target table. This use of column conditions for this purpose is appropriate only if the table contains a column that enables you to split the processing evenly among parallel Post processes.
Hash value: A hash partition (known as hash horizontal partitioning) directs SharePlex to create row partitions by using a hash algorithm. You can use a hash value to divide the rows of a table into parallel Post processing streams if it is not practical to use a column condition for this purpose. The advantage of using a hash partition rather than a column condition is that the rows are divided evenly and automatically, without the need for you to reference table columns in WHERE clauses.
Important: The following restrictions apply:
Hash horizontal partitioning is not supported for tables with operations that may cause rows to migrate. Examples of operations that cause rows to migrate are:
Note: On a Windows system, the use of numerous queues may require the number of semaphores to be increased. If Post returns the error message "shs_SEMERR: an error occurred with the semaphore," see the Post stopped topic in Solve replication problems .
A partition scheme is a logical container for related row partitions and is the element that is used in the configuration file to direct SharePlex to use horizontal partitioning. For example, a simple partition scheme named CORPORATE.SALES could have four column conditions, each replicating the appropriate data subsets of the CORPORATE.SALES table to different regional sales offices. You must also specify a partition scheme if using the hash horizontal partitioning option, even though SharePlex creates the partitions.
To direct SharePlex to use a specific partition scheme for a source table, you specify the partition scheme as the routing map in the configuration file. SharePlex obeys the specifications of the partition scheme to process the row subsets.
These instructions help you to define your partitions and link them to partition schemes. You define and link partitions by using the SHAREPLEX_PARTITION table.
Note: This table was installed in the SharePlex schema on the source system during the installation of SharePlex.
Use one SHAREPLEX_PARTITION table for all configurations that replicate data from the same Oracle instance. Enclose case-sensitive names in double quote marks, for example "Scott"."emp".
To define a partition based on a column condition
For each group of row subsets that you want to define as a partition, use a standard INSERT statement to enter the information described in "SHAREPLEX_PARTITION columns and input into the SHAREPLEX_PARTITION table.
To define a partition based on a hash
Use a standard INSERT statement to enter the information described in "SHAREPLEX_PARTITION columns and input" into one row of the SHAREPLEX_PARTITION table. One row captures the information that SharePlex needs to build the partitions automatically with a hash algorithm.
To route a partition to multiple targets
If a row partition must be sent to multiple target tables and the owner or table names are not all identical, do the following:
Table 11: SHAREPLEX_PARTITION columns and input
Column | Datatype | Input |
---|---|---|
PARTITION_SCHEME | VARCHAR2(30) |
The name of the partition scheme for which you are creating a row partition. You can:
|
DESCRIPTION | VARCHAR2(61) | A description of the partition. You can enter a NULL value, but if you are creating numerous partitions, it helps to identify or describe each one, for example to give each partition a name. |
TARGET_TABLE_OWNER | VARCHAR2(30) |
The owner of the target table. This can be one of the following:
|
TARGET_TABLE_NAME | VARCHAR2(30) |
The name of the target table. This can be one of the following:
|
ROUTE | VARCHAR2(1024) |
The routing map for this partition. This can be one of the following, depending on whether you are using a column condition or a hash to create the partitions. If creating a partition with a column condition:
If creating a partition with a hash: Use the following format to direct SharePlex to automatically generate the named post queues: host:name|#[o. | r.]database where:
|
PRIORITY | NUMBER | NULL. This column is reserved for use by SharePlex. |
ORDER | NUMBER |
NULL. This column is reserved for use by SharePlex. |
OPTIONS | VARCHAR2(32) |
Specify one of the following, depending on how you are defining the partitions: If defining a partition based on a column condition: NULL If defining a partition based on a hash: HASH#, where # is the number of partitions (post queues and processes) that you want SharePlex to use. The numbering starts at 0. For example, HASH4 creates the post queues hash00, hash01, hash02, and hash03. |
COL_CONDITIONS | VARCHAR2(1024) |
Specify one of the following, depending on how you are defining the partitions: If defining a partition based on a column condition: Use standard WHERE conditional syntax such as ((region_id = West) and region_id is not null). You can specify as many column conditions as needed. See How to create a column condition for additional instructions. If defining a partition based on a hash: Specify a value of ROWID. This directs SharePlex to create the hash based on the block where the row resides. |
The following are guidelines for creating column conditions.
Use columns whose values will not change, such as PRIMARY or UNIQUE key columns. The objective is to avoid a partition shift, where changes made to the conditional columns of a partition can cause the underlying data to satisfy the conditions of a different (or no) partition.
Example:
Column condition is “C1=A and C2=B”.
INSERT a row into the database. C1 and C2 values satisfy the column condition, so the row is replicated to the target system.
C1 | C2 | C3 | C4 |
A | B | 1 | 2 |
UPDATE ...set C1=B WHERE C1=A and C2=B
The change is replicated. Now the row does not satisfy the column condition, and subsequent changes to data in the row are not replicated.
C1 | C2 | C3 | C4 |
B | B | 1 | 2 |
Example:
Column condition is “C1=A and C2=B”.
INSERT a row into the database. C1 and C2 values do not satisfy the column condition, so the row is not replicated to the target system.
C1 | C2 | C3 | C4 |
B | B | 1 | 2 |
UPDATE ...set C1=A WHERE C1=B and C2=B
Now the row satisfies the column condition, so SharePlex replicates it, but Post cannot locate the corresponding row on the target (it was never there) and returns an out-of-sync error.
You can do either of the following to repair the out-of-sync rows:
Note: If you are using a column other than a key to base the column condition on, and you notice reduced performance with horizontally partitioned replication enabled, add a log group for that column.
SharePlex supports the following datatypes in column conditions:
CHAR
DATE
NUMBER
LONG VARCHAR
VARCHAR
VARCHAR2
Notes:
For the DATE datatype, SharePlex uses nls_date_format, with the syntax specified as MMDDSYYYYHH24MISS. For example:
hiredate<‘1111 2011000000’
Horizontally partitioned replication does not support the following:
The following list shows the conditional syntax that SharePlex supports in a column condition, where:
column = value
not (column = value)
column > value
value > column
column < value
column <= value
column >= value
column <> value
column != value
column like value
column between value1 and value2
not (column between value1 and value2)
column is null
column is not null |
Conditions can be combined into nested expressions with parentheses and the AND, OR, and NOT logical connectives.
Do not:
Use one configuration file for all of the data that you want to replicate from a given datasource, including tables that will have full-table replication and those that will use partitioned replication. For general instructions on creating a configuration file, see Create configuration files. To configure entries for horizontally partitioned replication, use the following syntax.
datasource_specification | ||
src_owner.table | tgt_owner.table |
!partition_scheme |
!routing_map |
Where:
src_owner.table and tgt_owner.table are the specifications for the source and target tables, respectively.
! routing_map is a placeholder routing map. It is required only if a route that you used in a partition scheme is not listed somewhere in the configuration file. SharePlex requires every route to be in the configuration file even if it is listed in a partition scheme.
Notes:
Configuration file entry to specify a partition scheme
Datasource:o.myora | ||
scott.emp | scott.emp_2 | !partition_emp |
scott.cust | scott.cust_2 | !partition_cust |
Correct way to specify multiple partition schemes for the same source table
Datasource:o.myora | ||
scott.emp | scott.emp_2 | !partition_schemeA |
scott.emp | scott.emp_3 | !partition_schemeB |
Correct way to specify placeholder routing map*
! targsys1 |
! targsys2@o.ora2+targsys3@o.ora3 |
*Required only for partitions based on column conditions.
When using hash-based horizontally partitioned replication, you can change the hash algorithm from the default of rowid-based to block-based. To enable the block-based hash option, set the SP_OCF_HASH_BY_BLOCK parameter to 1.
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy