Use horizontally partitioned replication to divide the rows of a table into separate processing streams. You can use horizontally partitioned replication to:
Oracle
All
To configure horizontally partitioned replication for a table, you do the following:
Define a partition scheme and one or more row partitions for the partition scheme.
A row partition is a defined subset of rows in a source table that you want to replicate to the target.
A partition scheme is a logical container for row partitions.
A partition scheme can be one of the following, depending on how the row partitions are defined:
You can use row partitions based on column conditions for the following purposes:
Use multiple row partitions to divide the rows of a table so that each set of rows replicates to a different target. For example, a table named CORPORATE.SALES could have two row partitions named "East" and "West." The column conditions are defined accordingly, where the rows that satisfy REGION = EAST replicate to one location and the rows that satisfy REGION = WEST replicate to a different location. The partition scheme could be named "Sales_by_region."
Use multiple row partitions to divide the rows of a table into parallel processing streams (parallel Export-Import-Post streams) for faster posting to a target table. For example, you can improve the flow of replication to a heavily updated target table. The 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.
For Oracle source data, you can use row partitions based on a hash value to divide the rows of a table into parallel processing streams (parallel Export-Import-Post streams) for faster posting to a target table. The advantage of using a hash value over column conditions to create partitions is that the rows are divided evenly and automatically by SharePlex, without the need to reference table columns in WHERE clauses. However, unlike column partition schemes, you cannot use the SharePlex compare or repair commands for hash partition schemes.
You can combine horizontally partitioned and vertically partitioned replication for maximum control over which information is distributed, and to where.
For example:
Horizontally partitioned replication can be used in conjunction with full-table replication for the same table, for example to route groups of rows to different reporting systems and all rows to a backup system.
SharePlex does not support a combination of horizontally partitioned replication and full-table replication if vertically partitioned replication is also used for the same table.
When using hash partitioning, the following limitations apply:
Do not use hash partitions if any operations on a table could cause rows to migrate. Examples of operations that cause rows to migrate are:
These instructions help you to define your row partitions and link them to partition schemes. You define and manage row partitions by using the Partition commands in sp_ctrl.
Note: SharePlex automatically creates a partition scheme when you define the first row partition for it. If you are making heavy use of horizontal partitioning, it may help to establish some naming conventions for your partition schemes. Optionally, you can assign names to row partitions if they are defined by column conditions.
To create a partition scheme based on column conditions
Issue the following command for each row partition that you want to create for a partition scheme. When you create the first row partition, SharePlex also creates the partition scheme that is specified in the command.
sp_ctrl> add partition to scheme_name set [name = name and ] condition = column_condition and route = value
See Description of command syntax
Examples
Route different sets of rows through different post queues:
sp_ctrl> add partition to scheme1 set name = q1 and condition = "C1 > 200" and route = sysb:q1@o.orasid
sp_ctrl> add partition to scheme1 set name = q2 and condition = "C1 < 200" and route = sysb:q2@o.orasid
Route different sets of rows to different targets:
sp_ctrl> add partition to scheme1 set name = east and condition = "area = east" and route = sys1e@o.orasid
sp_ctrl> add partition to scheme1 set name = west and condition = "area = west" and route = sys2w@o.orasid
To create a partition scheme based on a hash value
Issue the following command once to specify the number of hash partitions to create.
sp_ctrl> add partition to scheme_name set hash = value and route = value
See Description of command syntax
Example
Divide rows into four partitions, each processing through a different post queue:
sp_ctrl> add partition to scheme1 set hash = 4 and route = sysb:hash|#@o.ora112
Component | Description |
---|---|
scheme_name | Name of the partition scheme. SharePlex creates a partition scheme the first time that you issue an add partition command that includes the name of that scheme. There can be only one partition scheme per table in the configuration file. |
condition |
Column condition that defines the set of rows to be included in this partition. Use standard WHERE conditional syntax such as ((region_id = West) and region_id is not null). Important! For Microsoft SQL Server tables, the column conditions must only be based on the primary key columns. The condition and hash components are mutually exclusive. |
hash | (Valid for Oracle only) Hash value that specifies the number of row partitions that SharePlex creates based on the rowid. The hash and condition components are mutually exclusive. |
route |
Routing map for this partition. This can be one of the following, depending on whether you are using column conditions or a hash value to create the partition scheme. If creating a column partition scheme: Specify a standard SharePlex routing map, for example: sysB@o.myora, or a route that includes a named export or post queue. Compound routing maps are also supported. To route a partition to multiple target tables that have different names, do the following:
If creating a partition with a hash: Use the following format to direct SharePlex to create the named post queues: host:basename|#{o.SID | r.database} where:
|
name | (Optional) Short name of this partition. Useful only for partitions based on column conditions. The use of a short name eliminates the need to type out long column conditions in the event that you need to modify or drop the partition in the future. |
tablename | (Optional) Fully qualified target table name, if different from the source table name. If case-sensitive, the name must be specified as required by the database. |
description | (Optional) Description of this partition. |
The following are guidelines for creating column conditions. These guidelines do not apply to row partitions that are created with a hash value.
The types of columns on which you base your column conditions vary per data source:
Base column conditions on 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.
Partition shift case 1: The column value is updated so that the new value no longer satisfies any column condition:
Partition shift case 2: A row that satisfies one column condition gets updated to meet a different condition:
You have the following options for repairing the out-of-sync rows that are caused by changes to the values of column conditions:
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 data types in column conditions:
NUMBER |
NUMBER |
NUMBER |
NUMBER |
DATE |
CHAR |
VARCHAR VARCHAR2 LONG VARCHAR |
Notes:
For the dates, SharePlex uses 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. To configure entries for horizontally partitioned replication, use the following syntax.
Datasource:{o. | r.}database | ||
src_owner.table | tgt_owner.table |
!partition_scheme |
! | routing_map |
Configuration component | Description |
---|---|
o.database |
The datasource designation. Use the o. notation for an Oracle source. For database, specify the ORACLE_SID. |
src_owner.table and tgt_owner.table | The specifications for the source and target tables, respectively. |
!partition_scheme | The name of the partition scheme to use for the specified source and target tables. The ! is required. The name is case-sensitive. Compound routing of multiple partition schemes is not supported, for example !schemeA+schemeB. Create a separate entry for each partition scheme that you want to use for the same source table. See Examples. |
! routing_map |
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.
See Examples. |
Configuration file entry to specify a partition scheme
Datasource: r.mydb | ||
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: r.mydb | ||
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