Chat now with support
Chat mit Support

SharePlex 12.1 - Reference Guide

About this guide Conventions used in this guide SharePlex Commands for Oracle SharePlex parameters SharePlex Commands for PostgreSQL SharePlex Parameters for PostgreSQL Heterogeneous commands General SharePlex utilities Oracle Cloud Infrastructure SharePlex environment variables

Compare/Compare using

Compare/Compare using

Use the compare and compare using commands (collectively known as the comparison commands) to verify that a target table is in synchronization with its source table.

  • The compare command compares individual source and target tables or any number of tables in a given schema through the use of wildcards. When comparing individual tables, you can make use of column-based filtering to control the rows that are selected for comparison.
  • The compare using command compares all of the tables listed in the active configuration or in another file that contains a subset of the tables in the active configuration.

After running a comparison, you can run the repair or repair using command to repair any out-of-sync rows.

Note: A running comparison or repair does not affect the source tables in any way. SharePlex logs into the database only to query for read consistency, and the locks on the source tables are brief. SharePlex briefly locks the target tables during the processing, but users can continue accessing them with little or no awareness of the lock.

Supported operations

  • SharePlex can detect and repair out-of-sync rows in a target table that are caused by DML operations: INSERT, UPDATE, DELETE.

  • Compare/Repair can be executed on single or multiple instances that have the same Oracle client version, i.e., the same ORACLE_HOME. (applicable only for Oracle to Oracle replication)

Non-supported operations for Oracle as a source

SharePlex does not support (and will skip) the comparison and repair of the following:

  • If a table has a hash partition, comparing or repairing using the partition name is not supported. The user can use the table name instead. However, if the sub-partition is hash-based and the root partition is not, the user can use either the table name or the root partition name. (This limitation is applicable only for Oracle to PostgreSQL replication)

  • UDT inside VARRARY. Other UDTs are supported

  • Sequences

  • Tables for which transformation was used
  • Network configurations in which a pass-through server is used to pass data between the source and target servers.
  • XML type with different storage on the source and target (CLOB on source, BINARY on target, or the other way around). Like to like Compare/Repair is supported.

  • VARRAY types not inside SDO_GEOMETRY or ST_GEOMETRY.

  • Comparisons and repairs are not supported in a cascading replication environment.
  • Do not perform DDL on a table that is being compared or repaired. A comparison does not detect out-of-sync conditions caused by DDL operations, including those that SharePlex supports. If the DDL changes the table definition, it invalidates the SELECT statement that is built by the comparison process to get the rows that need to be compared.

    Once you correct an out-of-sync condition caused by DDL, you can use the repair command to resynchronize the data in the rows.

  • Comparison and repair command strings longer than 255 characters are not supported. This is an operating system limitation. To work around this limitation, use the edit command on the source system. You can type the command string within a text file, and then the command automatically executes the file.
  • If multiple ORACLE_HOME directories with different Oracle versions are installed on the same machine, users can perform compare/repair operations only for the Oracle version that was used during the SharePlex configuration.

See the SharePlex Release Notes for additional information about data types that are supported by compare and compare using.

Non-supported operations for PostgreSQL as a source

  • Network configurations in which a pass-through server is used to pass data between the source and target servers.

  • Comparisons and repairs are not supported in a cascading replication environment.

  • Comparison and repair command strings longer than 255 characters are not supported. This is an operating system limitation. To work around this limitation, use the edit command on the source system. You can type the command string within a text file, and then the command automatically executes the file.

Other conditions

  • The tables that you want to compare or repair must be part of an active configuration file.
  • Uncommitted transactions on a source table prevent the comparison and repair processes from obtaining the brief locks they need to obtain read consistency. Make certain that all transactions are committed before you run a comparison or repair.
  • Replication latency reduces the performance of compare and repair processing. The message from the source that spawns the comparison and repair processes on the target is sent through the queues with the replicated data. Delays caused by a data backlog also delay the spawn message and can cause the source process to lose its read consistency. If possible, perform comparisons and repairs during off-peak hours.

  • Do not truncate a table that is being compared or repaired. The comparison commands take a snapshot of each source table when they start. If a table is truncated, the table view in the snapshot is truncated, and this can cause the command to return invalid out-of-sync conditions.
  • (Applicable only for PostgreSQL source) To enhance the performance of the Compare process, SharePlex supports parallel hints via the SP_DEQ_PARALLELISM parameter, allowing you to specify the degree of parallelism, i.e., the number of worker processes to be launched.

    By default, the PostgreSQL database optimizer selects the best-suited query execution plan for SQL statements, which may not be directly related to the degree of parallelism specified in the parallel hints. pg_hint_plan makes it possible to adjust execution plans using parallel hints each time a query is executed. SharePlex internally utilizes the pg_hint_plan extension if it is installed or configured in the database.

    The example syntax to use parallel queries is as follows:

    The pg_hint_plan extension supports the Parallel hint: Parallel(table <# of workers> [soft|hard])

    SharePlex uses Parallel hints with hard parsing support: Parallel(table <# of workers> [hard])

    When performing table-level partitioning on DATE or TIMESTAMP data types in Oracle to PostgreSQL comparisons, the NLS_CALENDAR parameter must be set to GREGORIAN on the Oracle database.

    Note: The number of workers should be less than the CPU VCore of the database system.

  • If the Oracle table is set for replication to multiple targets that include Oracle and PostgreSQL (or other non-Oracle) targets, the compare command will stop with the message: "Oracle to multiple targets detected! Use 'at target' or 'to table' Compare/Repair options to select only one of its targets." (Applicable only for Oracle as a source).

  • It is expected that characters in the Oracle database are stored with the correct byte encoding, as per the character set specified in the NLS_CHARACTERSET (or NLS_NCHAR_CHARACTERSET for nchar, etc.). If the byte values are corrupted, Shareplex Compare/Repair will not be supported. For more information on setting NLS_LANG at the client or session level while inserting data into the DB, refer to https://docs.oracle.com/en/database/oracle/oracle-database/21/nlspg/setting-up-globalization-support-environment.html#GUID-372A5104-DC0A-41CA-B449-6AEC93F09C2E (Applicable only for Oracle as a source).

  • Ensure the following settings when users set the parameter SP_DEQ_USE_SP_CKSUM=1 and attempt to repair a table without a Primary Key (PK) during Oracle to PostgreSQL or PostgreSQL to PostgreSQL/Oracle replication:

    • Ensure that the table has a valid Primary Key (PK) or Unique Key (UK).

    • Set the parameter SP_DEQ_USE_SP_CKSUM=0 and exclude columns of the following types during the Compare/Repair process: LONG, BINARY_FLOAT, BINARY_DOUBLE, and NUMBER without precision.

Supported character sets

The following character sets are tested and supported for Oracle database as a source:

  • US7ASCII

  • UTF8

  • WE8ISO8859P1

  • AL16UTF16

  • AL32UTF8

Note: For Oracle-to-Oracle replication, users can replicate data across any combination of the character sets listed above.

The following character set combinations are tested and supported for Oracle to PostgreSQL replication:

  • WE8ISO8859P1 - Latin1

  • AL16UTF16 - UTF8, Latin1

  • AL32UTF8 - UTF8, Latin1

The following character set is tested and supported for PostgreSQL database as a source:

  • UTF8

  • Latin1

The following character set combinations are tested and supported for PostgreSQL to Oracle replication:

  • Latin1 - WE8ISO8859P1

  • UTF8 - WE8ISO8859P1

  • UTF8 - UTF8

The following character set combinations are tested and supported for PostgreSQL to PostgreSQL replication:

  • Latin1 - Latin1

  • UTF8 - UTF8

Special use cases

The following scenarios require special handling when running a comparison.

Use case Compare support
Consolidated replication

Consolidated replication is supported if the target database and Post processes are configured to add the ID of the source host to each row. To compare or repair the correct rows in the central target table, use the targetwhere option and base the where clause on the source ID value.

For example, to compare a table in the database at the Eastern headquarters of a company to the correct rows in the central corporate database, you could use a source ID of "East" for the Eastern database and then base the targetwhere clause on that value. Use the same targetwhere clause in the repair command. The comparison and repair processes can use the source ID value to select only the rows that are valid for the Eastern database.

To use the comparison or repair commands for any implementation of consolidated replication, other than one that identifies a source ID, may result in the unwanted deletion of target rows. For more information about this configuration, see the SharePlex Administration Guide.

You may need to combine the targetwhere option with the standard where option to ensure that the target rows are selected accurately.

Peer-to-peer replication

In a peer-to-peer configuration, you must decide which system is the trusted source system and which is the secondary, or target, system. The secondary system is the one where any repairs will be performed. Before you run a comparison or repair in a peer-to-peer environment, follow these steps:

  1. Stop user access on the secondary system and wait for replicated operations from that system to post to the trusted source database. Users can continue to access the source database.
  2. Issue the qstatus command on the source and secondary systems.
  3. When there are 10 or fewer messages in the queues, run the comparison from the source system.
  4. During a comparison, you can permit user access to the source and secondary databases after the sp_xdesvr and sp_xdeclt start.
  5. Use the repair command with the where option to repair selected rows in a target table without locking users out of the table.

For more information about this configuration, see the SharePlex Administration Guide.

Tables without keys

The comparison and repair commands issue a SELECT statement with an ORDER BY clause on the source and target systems. The ordering is faster if large tables have a primary key or a unique, non-null key and an index (preferably a unique index). Otherwise, all of the columns are used as a key.

If a table has no unique row identifier, but does have one or more columns that can identify a row as unique, you can use the compare command with the orderby option. When this option is used, SharePlex prints a notice to the sp_xdesvr log on the source system that the command used those columns as a key.

Limitation: Data inconsistency is likely to occur in replication or compare-repair processes when SharePlex replication involves tables containing non-key columns with duplicate data.

Tables with extra source or target columns

Use the compare command with the sourcewhere or targetwhere clause if the source or target table contains extra columns and those columns contain unique values on which to base the sorting. See Control which rows are compared.

Compare operation on the XML data (applicable only for Oracle to Oracle)

SharePlex displays the “ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT” error while performing the Compare operation on the XML data.

Workaround:

  1. Upgrade Oracle to version 19.19 DBRU

  2. Set an appropriate PGA_AGGREGATE_LIMITusing the Oracle suggested script provided below :

    WITH

    MAX_PGA as

    (select round(value/1024/1024,1) max_pga from v$pgastat where name='maximum PGA allocated'),

    MGA_CURR as

    (select round(value/1024/1024,1) mga_curr from v$pgastat where name='MGA allocated (under PGA)'),

    MAX_UTIL as

    (select max_utilization as max_util from v$resource_limit where resource_name='processes')

    SELECT

    a.max_pga "Max PGA (MB)",

    b.mga_curr "Current MGA (MB)",

    c.max_util "Max # of processes",

    round(((a.max_pga - b.mga_curr) + (c.max_util * 5)) * 1.1, 1) "New PGA_AGGREGATE_LIMIT (MB)"

    FROM MAX_PGA a, MGA_CURR b, MAX_UTIL c

    WHERE 1 = 1;

  3. Upgrade to or install the SharePlex version 11.1.

Oracle table having LONG, BINARY_FLOAT, BINARY_DOUBLE, and NUMBER without any size.

If SP_DEQ_USE_SP_CKSUM is set to 1, then the comparison is done by fetching values instead of calculating hashes using SQL queries, which is performance-taxing. CPU utilization is expected to spike depending on the table structure, row size, and row count.

If an Oracle DB table contains LONG, BINARY_FLOAT, BINARY_DOUBLE, or NUMBER without precision data types, the comparison is done by fetching values by default due to limitations in calculating hashes for these data types in SQL queries. To avoid high resource utilization in such cases, users will need to skip these columns from the comparison.

PostgreSQL table having NUMERIC (without precision), DOUBLE, or FLOAT

If SP_DEQ_USE_SP_CKSUM is set to 1, then the comparison is done by fetching values instead of calculating hashes using SQL queries, which is performance-taxing. CPU utilization is expected to spike depending on the table structure, row size, and row count.

If a PostgreSQL DB table contains NUMERIC (without precision), DOUBLE, or FLOAT data types, the comparison is done by fetching values by default due to limitations in calculating hashes for these data types in SQL queries. To avoid high resource utilization in such cases, users will need to skip these columns from the comparison.

How the comparison works

A comparison detects out-of-sync conditions in a target table that are caused by DML operations:

  • extra or missing rows
  • rows whose values do not match

When you run the compare or compare using command on the source system, SharePlex initiates the following events:

  1. The sp_cop process spawns a sp_xdesvr (server) process on the source system.
  2. The sp_desvr process returns control and use of the sp_ctrl interface to the user, and replication continues while the comparison proceeds.
  3. The sp_xdesvr process sends a message to the Post process to initiate a sp_xdeclt (client) process on the target system.
  4. The server and client processes establish direct communication with each other.
  5. The processes perform a sanity check by comparing the number of rows in the source and target tables. If the difference in the number of rows between a source and target table is larger than 20 percent, the command terminates. The sanity check prevents wasting time to compare or repair tables that could be fixed more quickly by reloading the target data. You can use the copy or append command to reload the target data or use another method of your choosing. To override the sanity check, reissue the compare command with the override option.
  6. To override the sanity check, reissue the Compare command with Override option.
  7. If the row count passes the sanity check, the tables are compared as follows:

    • If the compare command is being used, sp_xdesvr selects the source rows, and sp_xdeclt selects the target rows, then the rows are sorted and compared.
    • If the compare using command is being used, the sp_xdesvr process creates a number of processing threads on the target system. The value set by the SP_DEQ_THREADS parameter controls the number of threads created. Each thread spawns an sp_xdeclt (client) process. The server and client processes establish direct communication with each other. The processing load is divided among the client processes. The rows from each source and target table are selected, sorted and compared.
  8. When finished, the processes write their log files, and you can view the results with the show compare command.

Manage the SQL log file

The compare and repair commands write the SQL that is needed to repair any out-of-sync rows to a SQL file in the same location as the log files. If only a compare command is issued, SharePlex does not execute these SQL statements. If a repair command is issued, the command works identically to the compare commands except that it executes the SQL statements to repair the out-of-sync rows.

You can suppress the output of the SQL log file. Some reasons to suppress this file are:

  • The data contains sensitive information. The SQL log file is written in clear text. By not producing a SQL log file, the sensitive data is not persisted to disk, which may satisfy security requirements for data at rest, such as those required to meet PCI compliance standards.
  • The compared or repaired tables have a very large number of out-of-sync rows. A log file of this size can consume a large amount of disk space.

To suppress the SQL log file, use the nosqllog option with the compare or repair command.

To suppress the output of the SQL log file for all compare and repair runs while the current instance of SharePlex is running, set the SP_SYS_SECURE_MODE environment variable to 1. This variable must be set before starting SharePlex, so if the sp_cop process is running it must be restarted after setting this variable. When sp_cop is run with this environment variable, the compare and repair commands will not put data into SQL files and the Post process will not put data into the SharePlex error log.

Run multiple processes

All of the compare and repair commands enable you to run multiple processes concurrently.

  • Multiple compare and repair commands can operate concurrently, each processing a pair of source and target tables, or you can use one command with Oracle wildcards to specify multiple sets of tables. See the SharePlex Administration Guide for more information about how SharePlex supports wildcards. (applicable only for Oracle as a source)
  • The compare using and repair using commands operate on an entire file. For example, you can compare or repair the tables in an entire configuration file, or you can create one or more compare files or repair files to affect a subset of the target tables, and then run one or more of them concurrently. See the command syntax for instructions.

A maximum of 20 SharePlex processes can use the post queue at the same time, including the replication processes and the comparison and repair processes. It is recommended that you allow a maximum of five comparison and repair processes to run at any given time. By using the compare using and repair using commands, you can work around the 20-process limit by comparing more tables per process.

If a comparison or repair fails because the limit is reached, SharePlex logs a message to the Event Log.

Note: You can run multiple commands more easily by using the edit command to edit a previous command to create a new one.

Compare a subset of a configuration

You can compare subsets of an active configuration file in the following ways.

  • To compare all of the tables in replication that belong to one schema, use the compare command with a wildcard:

    sp_ctrl> compare scott.%

  • To compare all of the tables in a configuration file, use the compare using command:

    sp_ctrl> compare using myconfig

  • To compare all of the tables in replication to one target route, use the compare using command with the at option:

    Oracle: sp_ctrl> compare using config.active at prodsys@o.ora112

    PostgreSQL: sp_ctrl> compare using config.active at prodsys@r.database_name

  • To compare a custom subset of the tables in a configuration, specify them in a compare file. This is a plain text file that lists only the source tables that you want to compare. The target tables are taken from the configuration file at the time of comparison. You can create a compare file by using the create config or copy config command. Make certain to give this file a name that makes it clear it is not a configuration file. See the command syntax for more information.

Control which rows are compared

The compare and repair commands have where options that enable you to filter the rows that are selected for processing. By default, these commands affect all rows of a table and ignore columns in the target table that are not contained in the source table.

  • Use the where option to filter rows based on identically named columns in the source and target tables.

  • Use the where option for a table that uses vertically partitioned replication. The source and target columns can have different names. Base the where selection on the source columns. SharePlex reads the column mappings from the configuration file to build the correct WHERE clause for the target table.
  • Use the sourcewhere and targetwhere options if one or more extra columns exists in either the source or target table and those rows contain values that determine row uniqueness.

    • Use sourcewhere if the source table contains the extra columns.
    • Use targetwhere if the target table contains the extra columns.

    To use this option correctly:

    • Use a sourcewhere or targetwhere option only for the extra columns.
    • Use the standard where option for the other columns that have the same name on both source and target.

    • SharePlex combines the where option with the sourcewhere or targetwhere option to create the complete WHERE clause.

Important! If you plan to run both a comparison and repair for a target table that has extra rows, only use targetwhere to compare for UPDATEs and DELETEs. The repair command cannot determine the correct values for INSERTs. To work around this issue, set a default value for the extra columns or manually update the inserted rows.

Identify processes

Every time that a comparison or repair command is issued, the job ID is shown in the sp_ctrl display. If the sp_ctrl display is not available, you can view the job ID by running the compare status command.

View status and results in sp_ctrl

To view the status or results of a comparison, use the compare status command in sp_ctrl.

  • The basic command displays the processing status of the most recently started comparison job, as well as other comparison jobs that are still running.
  • Additional options can be used to display a status summary for comparison jobs for which there is history, or to display detailed information about a comparison job.

For more information, see Compare status.

View warnings and errors for Oracle to Oracle replication

The sp_desvr and sp_declt processes write a log file on the system where they run. The logs are stored in the log sub-directory of the SharePlex variable-data directory.

The name of the log written by the sp_desvr process is xdesvr_<jobid>_r.<dbid>_p<process id>.log, where:

  • JobID is the SharePlex-assigned job ID.
  • SID is the ORACLE_SID of the Oracle instance where the source table resides.
  • ProcessID is the process ID of the sp_desvr process.

The names of the files written by the sp_declt process are xdeclt_<jobid>-<tableid>_r.<dbid>_p<processid>.log appended with either .log or .sql, where:

  • JobID is the SharePlex-assigned job ID for the job.
  • TableID is the SharePlex-assigned table ID for the table in the job.
  • SID is the ORACLE_SID of the Oracle instance where the source table resides.
  • SourceHost is the name or IP address of the source host.
  • ProcessID is the process ID of the sp_declt process.

Example log file names:

xdesvr_7_r.aparopka_p4970.log

xdeclt_7-1_r.aparopka_p25095.log

xdeclt_7-1_r.aparopka_p25095_01.sql

To control disk usage, the logs are aged in a circular fashion. SharePlex generates a new log file when the current log reaches the size limit. New logs are created up to a maximum number of logs, and then SharePlex starts overwriting the oldest log.

View warnings and errors for Oracle to PostgreSQL and PostgreSQL as a source replication

The sp_xdesvr and sp_xdeclt processes write a log file on the system where they run. The logs are stored in the log sub-directory of the SharePlex variable-data directory.

The name of the log written by the sp_xdesvr process is xdesvr_<jobid>_r.<dbid>_p<process id>.log, where:

  • JobID is the SharePlex-assigned job ID.
  • DBID is the database ID of the PostgreSQL instance.
  • ProcessID is the process ID of the sp_xdesvr process.

The names of the files written by the sp_xdeclt process are xdeclt_<jobid>-<tableid>_r.<dbid>_p<processid>.log appended with either .log or .sql, where:

  • JobID is the SharePlex-assigned job ID for the job.
  • TableID is the SharePlex-assigned table ID for the table in the job.
  • DBID is the database ID of the PostgreSQL instance.
  • SourceHost is the name or IP address of the source host.
  • ProcessID is the process ID of the sp_declt process.

Example log file names:

xdesvr_7_r.aparopka_p4970.log

xdeclt_7-1_r.aparopka_p25095.log

xdeclt_7-1_r.aparopka_p25095_01.sql

To control disk usage, the logs are aged in a circular fashion. SharePlex generates a new log file when the current log reaches the size limit. New logs are created up to a maximum number of logs, and then SharePlex starts overwriting the oldest log.

Note: For the compare using command, there rarely is more than one log file.

Cancel a compare job

Use the cancel command to stop a running comparison or repair job.

sp_ctrl(sysA)>cancel JOBID

For more information, see Cancel.

Manage compare history and logs

SharePlex retains a history of each finished job in the database on the source system. The SP_SYS_JOB_HISTORY_RETENTION parameter controls how long history is retained.

To clear this history on demand, use the clear history command. When SharePlex removes the history of a job, it also removes the log file that was the source of the history.

To remove the log files from the source system without clearing the job history from the database, use the remove log command. You can also use this command to remove old log files from the target system.

To control the size of the log files, set the SP_DEQ_LOG_FILESIZE parameter.

To produce separate SQL files for INSERT, UPDATE, and DELETE operations, rather than use just one file for all operation types, use the log split option.

Control the batch size

You can control the size of the block of rows that is fetched when the process makes its SELECT query. The block size is calculated based on the value set with the SP_DEQ_MALLOC parameter. The value is divided equally by the number of comparison threads to be used, and then it is recalculated based on the size of all of the columns added together.

Note: To repair out-of-sync rows found by the comparison, use the repair or repair using command. See Repair / repair using.

Usage

Supported source and target combinations: Oracle to Oracle, Oracle to PostgreSQL, PostgreSQL to PostgreSQL, PostgreSQL to Oracle
Authorization level: Operator (2)
Issues on: source system
Related commands: Repair / repair using

Syntax

Command Command options Remote options
compareowner.source_table[.partition]

[ at target_host@o.target_sid ] | (applicable only for Oracle/PostgreSQL to Oracle)

[ for o.source_sid ] | (applicable only for Oracle to Oracle/PostgreSQL)

[ at target_host@r.target_db ] | (applicable only for Oracle/PostgreSQL to PostgreSQL)

[ for r.source_db ] | (applicable only for PostgreSQL to Oracle/PostgreSQL)

[ hinthint” ] | [ for o.source_sid ] | (applicable only for Oracle to Oracle/PostgreSQL)

[ {include | exclude} "column_list" ] |

[ key ] |

[ log rowdata ] |

[ log split ] |

[ {nolocksource | nolocktarget} ] |

[ nosqllog ] |

[ not "exception_list" ] |

[ orderby "column_list” ] |

[Override parameter to the compare and repair command] |

[ parallelism degree ] |

[ port port_number ] |

[ quickcheck ] |

[ sourcewhereclause” ] |

[ threads thread_count ] |

[ targetwhereclause” ] |

[ totarget_owner.target_table[.partition] ] |

[ whereclause” ]

[ on host |

on host:portnumber |

on login/password@host |

on login/password@host:portnumber ]

compare using filename

[key] |

[log rowdata] |

[log split] |

[parallelism degree] |

[port port_number] |

[quickcheck] |

[threads threads_count]

[ on host |

on host:portnumber |

on login/password@host |

on login/password@host:portnumber ]

Syntax description

Required command components

Component Description
compare owner.source_table[.partition]

The basic command compares all of the source rows with all of the target rows.

owner.source_table is the owner and name of the source table. Use double quotes to enforce case-sensitivity or spaces within a name, for example “HR”.emp.

Wildcarded table names (but not owner names) are supported. To be compared, tables that satisfy a wildcard in this command must be listed (explicitly or by wildcard) in the active replication configuration. For more information about how SharePlex handles wildcards, see the SharePlex Administration Guide.

Examples

sp_ctrl(sysA)>compare scott.emp

sp_ctrl(sysA)>compare scott.emp.west

When running a comparison from the command line of the operating system, if the table name is case-sensitive, quoted strings must include an extra set of escaped double quotes.

For example, if the table name is Dt_TOtalS1, the compare command should be:

splex_install/bin/./sp_ctrl compare splex."\"Dt_TOtalS1\""

compare using filename

The basic command compares all of the source rows with all of the target rows in the tables listed in filename.

filename is the name of the file that contains the names of the source tables that you want to compare.

Example

sp_ctrl(sysA)>compare using sales

Optional command components

Component Description
at target_host@o.target_sid (applicable only for Oracle to Oracle)

Valid for compare

Compares the source table to only one of its targets. Use when the source table replicates to multiple target systems.

target_host is the name of the target system.

target_sid is the ORACLE_SID of the target Oracle instance.

Example

sp_ctrl(SysA)>compare scott.emp at prod@o.prodsid

for o.SID (applicable only for Oracle to Oracle)

Valid for compare

Specifies the Oracle instance that contains the source table. Use when the same source table is in multiple Oracle instances on a system.

SID is the ORACLE_SID of the source instance. It is case-sensitive and must be typed as it appears in the oratab file or V$PARAMETER table, or Windows Registry.

When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example

sp_ctrl (SysA)>compare scott.emp for o.oraA

at target_host@r.target_database_name (applicable only for PostgreSQL as a source)

Valid for compare

Compares the source table to only one of its targets. Use when the source table replicates to multiple target systems.

target_host is the name of the target system.

target_db is the name of the target database name.

Example

sp_ctrl(SysA)>compare scott.emp at prod@r.database_name

for r.DBID (applicable only for PostgreSQL as a source)

Valid for compare

Specifies the PostgreSQL instance that contains the source table. Use when the same source table is in multiple PostgreSQL instances on a system.

DBID is the database name of the PostgreSQL source instance. It is case-sensitive and must be typed as it appears in the config file.

When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example

sp_ctrl (SysA)>compare scott.emp for r.database_name

hint "hint" (applicable only for Oracle to Oracle/PostgreSQL)

Valid for compare

Includes an Oracle hint in the SELECT statement. The hint is used on the source and target systems.

hint” is a standard Oracle hint no longer than 2000 characters. Enclose the entire hint within double quotes. Omit the leading /*+ and trailing */ in the hint string. They are added by SharePlex.

When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example

sp_ctrl (SysA)>compare scott.emp where “file >001005” hint “emp(salary)”

When running a comparison from the command line of the operating system, quoted strings must have an extra set of escaped double quotes as in this example:

/productdir/bin/sp_ctrl compare scott.emp hint “\“emp(salary)\””

Note: The Hint component is not supported on PostgreSQL by default. To enable this feature on PostgreSQL, users must configure the following parameters:
  • SP_DEQ_PG_FORCE_PARALLEL

  • SP_DEQ_PG_PARALLEL_MAX

  • SP_DEQ_PG_PARALLEL_SETUP_COST

  • SP_DEQ_PG_PARALLEL_TUPLE_COST

{include | exclude} "(column_list")

Valid for compare

Filters the columns to be compared.

  • Use include to specify columns that you want to compare. No other columns are compared. You must include all of the key columns in an include clause.
  • Use exclude to compare all columns except those specified with exclude. Do not exclude any key columns.

(column_list) is the list of columns to include or exclude.

  • Separate each name with a comma. No spaces are permitted in the list unless the name of a column contains spaces.
  • Enclose the column list within double quote marks.
  • List columns in any order. The sort is performed in ascending order.
  • Column names are not case-sensitive.
  • When used, this option must appear after the required arguments of the command, but it can appear in any order with other options.

Note: There could still be rows that are out-of-sync in the columns that were not compared.

Example

sp_ctrl (SysA)>compare scott.emp exclude "color, weight"

key

Valid for compare and compare using

Performs a fast comparison of large tables. This command does not compare all of the data values. It compares one of the following:

  • Only the PRIMARY key or non-null UNIQUE key columns.

    Or...

  • The columns specified with the orderby option. Use this option if the tables have no keys.

Important: Even if the keys or the orderby values match, the tables remain out of synchronization if values in other columns do not match.

When used, this option must appear after the required command arguments. It can appear in any order with other options.

Do not use this option to base a comparison on a SharePlex key definition. For more information about SharePlex key definitions, see the SharePlex Administration Guide.

Example

sp_ctrl (SysA)>compare scott.emp key

sp_ctrl(sysA)>compare using sales key

log rowdata

Valid for compare and compare using

Directs the client process to produce a SQL file that logs the actual row data rather than hash values. The file is produced on the target system. If the value of any of these data types is very large, SharePlex may not be able to log the actual data.

IMPORTANT! The purpose of this SQL file is to provide a view of the data that was compared. Do not use it to repair target tables. The data values that were captured when the command was run may be different from those currently in the database. Use the repair command to repair any out-of-sync rows.

Example

sp_ctrl(sysA)>compare scott.emp log rowdata

sp_ctrl(sysA)>compare using sales log rowdata

log split

Valid for compare and compare using

Directs the client process to split its SQL file into three different files based on the operation type: one for INSERTs, one for UPDATEs, and one for DELETEs.

Example

sp_ctrl(sysA)>compare scott.emp log split

sp_ctrl(sysA)>compare using sales log split

{nolocktarget | nolocksource}

Valid for compare

Prevents the comparison process from locking tables during the comparison phase of a run that includes a repair. Normally, SharePlex locks the tables momentarily during a comparison to get a read-consistent view, and then unlocks them immediately, but SharePlex always locks target tables during a repair. SharePlex locks source tables momentarily during a repair to get a read-consistent view.

Example

sp_ctrl(sysA)>compare scott.emp nolocksource

sp_ctrl(sysA)>compare scott.emp nolocktarget

nosqllog

Suppresses output of the SQL log file. This file contains the SQL that is needed to repair out-of-sync rows. Some reasons not to output this file include:

  • The data contains sensitive information. The SQL log file is written in clear text. By not producing a SQL log file, the sensitive data is not persisted to disk, which may satisfy security requirements for data at rest, such as those required to meet PCI compliance standards.
  • The compared or repaired tables have a very large number of out-of-sync rows. A log file of this size can consume a large amount of disk space.
notexception_list

Valid for compare

Specifies an exception list of tables not to compare when the table specification includes wildcards.

exception_list” is a list of names of the tables not to compare.

  • Use the owner.tablename format.
  • Separate each name with a comma. No spaces are permitted in the list.
  • Enclose the list within double quote marks.
  • List the tables in any order.
  • When used, this option must appear after the required arguments of the command, but it can appear in any order with other options.

Example

sp_ctrl(SysA)>compare scott.% not (%temp%)

orderbycolumn_list

Valid for compare

Specifies columns for the comparison process to use in its ORDERBY clause when it sorts rows to be compared. This option enables comparisons to be performed on tables that have no primary or unique key.

column_list” is the names of the columns to use in the ORDERBY clause.

  • Separate each name with a comma. No spaces are permitted in the list unless the name of a column contains spaces.
  • Enclose the column list within double quote marks.
  • List columns in any order. The sort is performed in ascending order.
  • Column names are not case-sensitive.
  • When used, this option must appear after the required arguments of the command, but it can appear in any order with other options.

Example

sp_ctrl(SysA)>compare scott.emp where “file >001005” orderby “Last Name,Division”

When running a comparison from the command line of the operating system, quoted strings must have an extra set of escaped double quotes:

/productdir/bin/sp_ctrl compare scott.emp orderby “\“Last Name,Division\””

override

Valid for compare and compare using

Overrides the sanity check and allows the comparison of tables that are out-of-sync beyond the sanity check threshold.Use an alternative method to re-sync the target table, similar to the initial process used for instantiating the target database/table. For more information about sanity check, see how the comparison works.

Example:

SP_ctrl (sysA) > compare scott.emp override

SP_ctrl (sysA) > compare using sales override

port port_number (applicable only for Oracle to Oracle)

Valid for compare and compare using

Available for backward compatibility if the version of SharePlex is earlier than 8.0 on the source or target system.

Specifies a port on the source system for the client process to use for communication with the server process. In earlier versions of SharePlex, the communication is two-way, and a random port number is selected by default for client-to-server communication. This option overrides the random port selection with a specific port number, such as that required by a firewall.

Example

sp_ctrl(sysA)>compare scott.emp port 1234

quickcheck

Valid for compare and compare using

Performs an initial check to determine if any rows are out of synchronization. As soon as one out-of-sync row is detected, the process stops. No further information is returned. No out-of-sync row information is logged to the compare SQL file.

Do not use this option with the key option or any of the where options.

This option does not support LONG columns.

Example

sp_ctrl(sysA)>compare scott.emp quickcheck

sp_ctrl(sysA)>compare using sales quickcheck

parallelism degree

Valid for compare and compare using

Adds a parallel hint to the SELECT statement. For degree, set the degree of parallelism.

Example

sp_ctrl(sysA)>compare scott.emp parallelism 4

sp_ctrl(sysA)>compare using sales parallelism 4

sourcewhereclause

Valid for compare

Bases the comparison on one or more columns in the source table when those columns do not exist in the target table. Rows filtered by this condition on the source table will be locked.

  • Enclose clause within double quote marks and refer to tables by their fully qualified names, for example scott.emp.
  • Use double quote marks to enforce case sensitivity or spaces within a table name.
  • Dates must be in the format of 'YYYYSMMDDHH24MISS'. To convert a date to that format, use the PostgreSQL TO_DATE function. For example if c1 is a DATE column, the WHERE clause "c1 > '10-SEP-2001'" will not work, but "c1 > to_date('10- SEP-2001', 'DD-MON-YYYY')" will work.
  • When running a comparison from the command line of the operating system, quoted strings must have an extra set of escaped double quotes, like the following example:

    sp_ctrl>compare scott.emp sourcewhere “\“file >001005\””

  • When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example #1:

sp_ctrl(sysA)>compare scott.emp sourcewhere “file >001005”

Example #2:

The following example shows how the sourcewhere and where options are combined to get the desired result. Only the source comparison process will use the sourcewhere clause, but both the source and target comparison processes will use the where clause.

sp_ctrl(SysA)>compare scott.emp sourcewhere “deptno = 200” where “mgr = ‘SMITH’”

targetwhere "clause"

Valid for compare

Bases the comparison on one or more columns in the target table when those columns do not exist in the source table. Rows filtered by this condition on the target table will be locked.

  • Enclose the clause within double quote marks and refer to tables by their fully qualified names, for example scott.emp.
  • Use double quote marks to enforce case sensitivity or spaces within a table name.
  • Dates must be in the format of 'YYYYSMMDDHH24MISS'. To convert a date to that format, use the PostgreSQL TO_DATE function. For example if c1 is a DATE column, the WHERE clause "c1 > '10-SEP-2001'" will not work, but "c1 > to_date('10- SEP-2001', 'DD-MON-YYYY')" will work.
  • When running a comparison from the command line of the operating system, quoted strings must have an extra set of escaped double quotes:

    /productdir/bin/sp_ctrl compare scott.emp targetwhere “\“file >001005\””

  • When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example #1:

sp_ctrl(SysA)> compare scott.emp targetwhere “file >001005”

Example #2:

The following example shows how the targetwhere and where options are combined to get the desired result. Only the target comparison process will use the targetwhere clause, but both the source and target comparison processes will use the where clause.

sp_ctrl(SysA)>compare scott.emp where “deptno = 200” targetwhere “mgr = ‘SMITH’” repair

threads thread_count

Valid for compare and compare using

Sets the number of processing threads that are used by the comparison process.

Example

sp_ctrl(sysA)>compare scott.emp threads 4

sp_ctrl(sysA)>compare using sales threads 4

to target_owner.target_table[.partition]

Valid for compare

Compares the source table to only one of its targets. Use when the source table replicates to multiple target systems and the target tables have different names.

This option can also be used to specify a target partition.

compare source_owner.source_table.[source_partition] to target_owner.target_table.[target_partition]

Example

(Compares a partition)

sp_ctrl(SysA)>compare scott.emp.east to scott.allemp.alleast

whereclause

Valid for compare

Include a WHERE clause in the SELECT statement on both the source and target systems. The WHERE clause acts as a filter to compare specific rows. Rows filtered by this condition will be locked.

For “clause” specify a standard WHERE clause that does not include subqueries.

  • Enclose the clause within double quote marks and refer to tables by their fully qualified names, for example scott.emp.
  • Use double quote marks to enforce case sensitivity or spaces within a table name.
  • Dates must be in the format of 'YYYYSMMDDHH24MISS'. To convert a date to that format, use the PostgreSQL TO_DATE function. For example if c1 is a DATE column, the WHERE clause "c1 > '10-SEP-2001'" will not work, but "c1 > to_date('10- SEP-2001', 'DD-MON-YYYY')" will work.
  • When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example

sp_ctrl (SysA)>compare scott.emp where “region=4”

Remote options

These options enable you to issue the command on a remote machine and to script commands that include a login name, password, port number, or combination of those items.

Option Description
on host

Execute the command on a remote system (one other than the one where the current sp_ctrl session is running). You are prompted for login credentials for the remote system. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on SysA

on host:portnumber

Execute the command on a remote system when a remote login and port number must be provided. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on SysA:8304

on login/password@host

Execute the command on a remote system when a remote login, password, and host name must be provided. If used, must be the last component of the command syntax.

Example:sp_ctrl(sysB)>status on john/spot5489@SysA

on login/password@host:portnumber

Execute the command on a remote system when a remote login, password, host name, and port number must be provided. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on john/spot5489@SysA:8304

Repair/Repair using

Use the repair and repair using commands (collectively known as the repair commands) to repair out-of-sync rows in a target table or tables.

  • The repair command repairs individual target tables or any number of target tables in a given schema through the use of wildcards. When repairing individual tables, you can make use of column-based filtering to control the rows that are selected for repair.
  • The repair using command repairs all of the target tables listed in the active configuration or in another file that contains a subset of the tables in the active configuration.

The repair commands first perform a comparison to identify the rows that need to be repaired, and then they perform the repair. For more information about how tables are compared, see Compare / compare using.

Note: A running comparison or repair does not affect the source tables in any way. SharePlex logs into the database only to query for read consistency, and the locks on the source tables are brief. SharePlex briefly locks the target tables during the processing, but users can continue accessing them with little or no awareness of the lock. Target table (or Out-Of-Sync rows if less than threshold value) is locked during the repair process to correct any Out-of-Sync rows.

Supported operations

  • SharePlex can detect and repair out-of-sync rows in a target table that are caused by DML operations: INSERT, UPDATE, DELETE.

  • Compare/Repair can be executed on single or multiple instances that have the same Oracle client version, i.e., the same ORACLE_HOME. (applicable only for Oracle to Oracle replication)

Non-supported operations for Oracle as a source

SharePlex does not support (and will skip) the comparison and repair of the following:

  • If a table has a hash partition, comparing or repairing using the partition name is not supported. The user can use the table name instead. However, if the sub-partition is hash-based and the root partition is not, the user can use either the table name or the root partition name. (This limitation is applicable only in Oracle to PostgreSQL replication)

  • UDT inside VARRAY. Other UDTs are supported.
  • Sequences.
  • Tables for which transformation was used.
  • Network configurations in which a pass-through server is used to pass data between the source and target servers.
  • XML type with different storage on the source and target (CLOB on source, BINARY on target, or the other way around). Like to like compare/repair is supported.
  • VARRAY types not inside SDO_GEOMETRY or ST_GEOMETRY.
  • Comparisons and repairs are not supported in a cascading replication environment.
  • Do not perform DDL on a table that is being compared or repaired. A comparison does not detect out-of-sync conditions caused by DDL operations, including those that SharePlex supports. If the DDL changes the table definition, it invalidates the SELECT statement that is built by the comparison process to get the rows that need to be compared.

    Once you correct an out-of-sync condition caused by DDL, you can use the repair command to resynchronize the data in the rows.

  • Comparison and repair command strings longer than 255 characters are not supported. This is an operating system limitation. To work around this limitation, use the edit command on the source system. You can type the command string within a text file, and then the command automatically executes the file.
  • If multiple ORACLE_HOME directories with different Oracle versions are installed on the same machine, users can perform compare/repair operations only for the Oracle version that was used during the SharePlex configuration.

Non-supported operations for PostgreSQL as a source

  • Network configurations in which a pass-through server is used to pass data between the source and target servers.

  • Comparisons and repairs are not supported in a cascading replication environment.

  • Comparison and repair command strings longer than 255 characters are not supported. This is an operating system limitation. To work around this limitation, use the edit command on the source system. You can type the command string within a text file, and then the command automatically executes the file.

See the SharePlex Release Notes for additional information about data types that are supported by compare and compare using

Other conditions

  • The tables that you want to compare or repair must be part of an active configuration file.
  • Uncommitted transactions on a source table prevent the comparison and repair processes from obtaining the brief locks they need to obtain read consistency. Make certain that all transactions are committed before you run a comparison or repair.
  • Replication latency reduces the performance of compare and repair processing. The message from the source that spawns the comparison and repair processes on the target is sent through the queues with the replicated data. Delays caused by a data backlog also delay the spawn message and can cause the source process to lose its read consistency. If possible, perform comparisons and repairs during off-peak hours.

  • Do not truncate a table that is being compared or repaired. The comparison commands take a snapshot of each source table when they start. If a table is truncated, the table view in the snapshot is truncated, and this can cause the command to return invalid out-of-sync conditions.
  • To repair a view, the following must be true:

    • The view table must contain all of the constraint columns of the underlying table.
    • The names of the constraint columns in the view must be identical to the names of the constraint columns in the underlying table.
  • If the Oracle table is set for replication to multiple targets that include Oracle and PostgreSQL (or other non-Oracle) targets, the compare command will stop with the message: "Oracle to multiple targets detected! Use 'at target' or 'to table' compare/repair options to select only one of its targets."

  • When performing table-level partitioning on DATE or TIMESTAMP data types in Oracle to PostgreSQL comparisons, the NLS_CALENDAR parameter must be set to GREGORIAN on the Oracle database.

  • It is expected that characters in the Oracle DB are stored with the correct byte encoding, as per the character set specified in the NLS_CHARACTERSET (or NLS_NCHAR_CHARACTERSET for nchar, etc.). If the byte values are corrupted, Shareplex compare/repair will not be supported. For more information on setting NLS_LANG at the client or session level while inserting data into the DB, refer to https://docs.oracle.com/en/database/oracle/oracle-database/21/nlspg/setting-up-globalization-support-environment.html#GUID-372A5104-DC0A-41CA-B449-6AEC93F09C2E

  • Ensure the following settings when users set the parameter SP_DEQ_USE_SP_CKSUM=1 and attempt to repair a table without a Primary Key (PK) during Oracle to PostgreSQL or PostgreSQL to PostgreSQL/Oracle replication:

    • Ensure that the table has a valid Primary Key (PK) or Unique Key (UK).

    • Set the parameter SP_DEQ_USE_SP_CKSUM=0 and exclude columns of the following types during the Compare/Repair process: LONG, BINARY_FLOAT, BINARY_DOUBLE, and NUMBER without precision.

Supported character sets

The following character sets are tested and supported for Oracle database as a source:

  • US7ASCII

  • UTF8

  • WE8ISO8859P1

  • AL16UTF16

  • AL32UTF8

Note: For Oracle-to-Oracle replication, users can replicate data across any combination of the character sets listed above.

The following character set combinations are tested and supported for Oracle to PostgreSQL replication:

  • WE8ISO8859P1 - Latin1

  • AL16UTF16 - UTF8, Latin1

  • AL32UTF8 - UTF8, Latin1

The following character set is tested and supported for PostgreSQL database as a source:

  • UTF8

  • Latin1

The following character set combinations are tested and supported for PostgreSQL to Oracle replication:

  • Latin1 - WE8ISO8859P1

  • UTF8 - WE8ISO8859P1

  • UTF8 - UTF8

The following character set combinations are tested and supported for PostgreSQL to PostgreSQL replication:

  • Latin1 - Latin1

  • UTF8 - UTF8

How to use the repair commands

The recommended procedure for maintaining synchronized data through the comparison and repair commands is to run the compare or compare using command first, then view the results with the repair status command. This command shows any rows that are out-of-sync and the possible cause. Unless the cause of the out-of-sync condition is corrected, replication will go out of synchronization again, even if you repair the rows this time. After the problem is fixed, issue the repair or repair using command.

You can run the repair or repair using command without doing a preliminary comparison. The command performs a comparison first, to identify the out-of-sync rows, and then it repairs those rows. However, the underlying cause of the out-of-sync condition must be corrected to prevent future out-of-sync conditions.

See the SharePlex Administration Guide for causes and solutions for out-of-sync conditions.

When to run the repair

The best time to repair a target table depends on its size, the cause of the problem, the extent of out-of-sync rows, and how long you are willing to tolerate users being locked out. Before you initiate a repair, consider the following:

  • Although the users of the tables are not usually affected by the brief locks that are applied when tables are compared, they are locked out of the target table for the duration of the repair process. For a small table, this might not be disruptive, but for a large table needing extensive repairs, the wait can be significant.
  • Locks on a target table can reduce posting performance if Post must wait for the repair to finish before it can apply changes to that table and move on to other tables. This increases the latency of the target data and causes operations to accumulate in the post queue. If the objects that Post needs to change are different from those being repaired, the two processes run simultaneously.
  • If you must repair a table immediately, but cannot tolerate locks or replication latency, you can use the where option to limit the repair to certain rows. An alternative is to use the key option, but this option may cause the repair to miss some out-of-sync rows.

  • If the repair can wait, correct the cause of the problem immediately and then do the repair during non-peak hours.

Special use cases

The following scenarios require special handling when running a comparison.

Use case Compare support
Consolidated replication

The target table in a central database has more rows than any of its contributing source databases, and often it has more columns than the source databases. Special consideration is required when using the repair commands in this environment.

repair using command

Consolidated replication is not supported by the repair using command. The repair using command will cause unwanted deletion of target rows that do not exist in those source tables.

As a workaround, create a subset of the configuration that excludes the tables that are involved in consolidated replication, and repair the subset configuration instead. You can use the repair command to repair the tables that are involved in consolidated replication.

repair command

Consolidated replication is supported if the target database and Post processes are configured to add the ID of the source host to each row. To compare or repair the correct rows in the central target table, use the targetwhere option and base the where clause on the source ID value.

For example, to compare a table in the database at the Eastern headquarters of a company to the correct rows in the central corporate database, you could use a source ID of "East" for the Eastern database and then base the targetwhere clause on that value. Use the same targetwhere clause in the repair command. The comparison and repair processes can use the source ID value to select only the rows that are valid for the Eastern database.

The use the comparison or repair commands for any implementation of consolidated replication, other than one that identifies a source ID, may result in the unwanted deletion of target rows. For more information about this configuration, see the SharePlex Administration Guide.

You may need to combine the targetwhere option with the standard where option to ensure that the target rows are selected accurately.

Peer-to-peer replication

In a peer-to-peer configuration, you must decide which system is the trusted source system and which is the secondary, or target, system. The secondary system is the one where any repairs will be performed. Before you run a comparison or repair in a peer-to-peer environment, follow these steps:

  1. Stop user access on the secondary system and wait for replicated operations from that system to post to the trusted source database. Users can continue to access the source database.
  2. Issue the qstatus command on the source and secondary systems.
  3. When there are 10 or fewer messages in the queues, run the comparison from the source system.
  4. During a comparison, you can permit user access to the source and secondary databases after the sp_xdesvr(PostgreSQL) or sp_desvr(Oracle) and sp_xdeclt(PostgreSQL) or sp_declt(Oracle) start.
  5. Use the repair command with the where option to repair selected rows in a target table without locking users out of the table.

For more information about this configuration, see the SharePlex Administration Guide.

Tables without keys

The comparison and repair commands issue a SELECT statement with an ORDER BY clause on the source and target systems. The ordering is faster if large tables have a primary key or a unique, non-null key and an index (preferably a unique index). Otherwise, all of the columns are used as a key.

If a table has no unique row identifier, but does have one or more columns that can identify a row as unique, you can use the compare command with the orderby option. When this option is used, SharePlex prints a notice to the sp_xdesvr (PostgreSQL) or the sp_desvr(Oracle) log on the source system that the command used those columns as a key.

The columns considered as keys should not contain null values if a repair needs to be done for a single row; it may result in a repair error. In this case, use the orderby option with columns that uniquely identify that row and do not contain null values.

 

Limitation: Data inconsistency is likely to occur in replication or compare-repair processes when SharePlex replication involves tables containing non-key columns with duplicate data.

Target tables with more columns than the source table

The repair and repair using commands ignore target columns that are not contained in the source table. A repair does the following:

  • An INSERT inserts values into target columns that have corresponding columns in the source table, but not into the extra columns. Columns with NOT NULL constraints but no default values cause PostgreSQL errors. Default values are recommended for extra columns in target tables.
  • An UPDATE resynchronizes values in target columns that have corresponding columns in the source table, but not the values in the extra columns.
  • A DELETE is not affected by extra columns in the target table, because the repair command selects rows based on column data in the matching columns.
Tables with a UNIQUE constraint

Columns defined with a UNIQUE constraint can cause the repair or repair using command to return unique-constraint violation errors. The following example shows source and target tables with two columns each. The first column is the primary key, and the second column has the UNIQUE constraint.

When SharePlex attempts to repair row 1 of the target table to match the source, the UNIQUE constraint on column 2 returns an error because the value 'ABC' already exists in row 2. The same thing happens for row 2 of the target table, because 'XYZ' already exists in row 1. Workarounds are:

  • Disable UNIQUE constraints on the target table before you run a repair command, then enable them again after the repair is finished.
  • Delete the target rows for which the unique constraint violations occurred, then run the repair again so that SharePlex inserts those rows with the correct data.
Tables with LOB columns

Repairs take longer if any target tables have LOB columns. For a faster repair, you can set the SP_DEQ_SKIP_LOB parameter to 0 so that the LOB columns are skipped in the comparison and repair. For more information, see SP_DEQ_SKIP_LOB .

Repair operation on the XML data (valid only for Oracle to Oracle replication)

SharePlex displays the “ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT” error while performing the Repair operation on the XML data.

Workaround:

  1. Upgrade Oracle to version 19.19 DBRU

  2. Set an appropriate PGA_AGGREGATE_LIMITusing the Oracle suggested script provided below :

    WITH

    MAX_PGA as

    (select round(value/1024/1024,1) max_pga from v$pgastat where name='maximum PGA allocated'),

    MGA_CURR as

    (select round(value/1024/1024,1) mga_curr from v$pgastat where name='MGA allocated (under PGA)'),

    MAX_UTIL as

    (select max_utilization as max_util from v$resource_limit where resource_name='processes')

    SELECT

    a.max_pga "Max PGA (MB)",

    b.mga_curr "Current MGA (MB)",

    c.max_util "Max # of processes",

    round(((a.max_pga - b.mga_curr) + (c.max_util * 5)) * 1.1, 1) "New PGA_AGGREGATE_LIMIT (MB)"

    FROM MAX_PGA a, MGA_CURR b, MAX_UTIL c

    WHERE 1 = 1;

  3. Upgrade to or install the SharePlex version 11.1.

How the repair works

A repair repairs out-of-sync conditions in a target table that are caused by DML operations:

  • extra or missing rows
  • rows whose values do not match

The conditions for a repair

The repair and repair using commands issue the following corrective SQL statements:

  • If a row exists on the source side but not the target side, SharePlex issues an INSERT statement.
  • If a row exists on the target side but not the source side, SharePlex issues a DELETE statement.
  • If a target row differs from the source row, and the key columns match, SharePlex issues an UPDATE statement based on the source values.
  • If you are using the repair or repair using command for an Oracle partitioned table, the default behavior of the repair process is to repair rows by using INSERTs and DELETEs only. Repairs that require UPDATEs are converted to a DELETE followed by an INSERT to prevent errors should an UPDATE cause a row to change partitions and row movement is not enabled for the table. You can change the repair behavior so that SharePlex repairs partitioned tables by using INSERTs, UPDATEs, and DELETEs as appropriate. For more information, see SP_DEQ_PART_TABLE_UPDATE .

The process

A repair always includes a comparison to locate the out-of-sync conditions in a target table.

When you run the repair or repair using command, SharePlex initiates the following sequence of events:

  1. The sp_cop process spawns a sp_xdesvr (PostgreSQL) or sp_desvr (Oracle) server process on the source system.
  2. The sp_xdesvr (PostgreSQL) or the sp_desvr (Oracle) process returns control and use of the sp_ctrl interface to the user, and replication continues while the comparison proceeds.
  3. The sp_xdesvr (PostgreSQL) or the sp_desvr (Oracle) process sends a message to the Post process to initiate a sp_xdeclt (PostgreSQL) or sp_declt (Oracle) client process on the target system.
  4. The server and client processes establish direct communication with each other.
  5. The row selection and repair proceeds as follows:

    • If the repair command is being used, the sp_xdesvr (PostgreSQL) or the sp_desvr(Oracle) selects the rows from the source tables, and sp_declt selects the rows from the target tables. The rows are sorted, compared and repaired.
    • If the repair using command is being used, the sp_xdesvr (PostgreSQL) or the sp_desvr (Oracle) process creates a number of processing threads on the target system. The value set by the SP_DEQ_THREADS parameter controls the number of threads created. Each thread spawns an sp_xdeclt (PostgreSQL) or sp_declt (Oracle) client process. The server and client processes establish direct communication with each other. The processing load is divided between the client processes. The rows from each source and target table are selected, sorted, compared, and repaired. The target tables are locked when it is their turn to be repaired, and then the lock is released.
    • Target tables are locked when it is their turn to be repaired, and then the lock is released.

  6. When finished, the processes write their log files, and you can view the results with the show repair command.

Error handling

If SharePlex encounters a database error when it applies a repair SQL statement, it stops the repair from that statement forward and commits only the previously applied valid statements. Thus, the table is partially repaired, but it still could be out of synchronization. The repair status command alerts you to this situation.

Manage the SQL log file

The compare and repair commands write the SQL that is needed to repair any out-of-sync rows to a SQL file in the same location as the log files. If only a compare command is issued, SharePlex does not execute these SQL statements. If a repair command is issued, the command works identically to the compare commands except that it executes the SQL statements to repair the out-of-sync rows.

You can suppress the output of the SQL log file. Some reasons to suppress this file are:

  • The data contains sensitive information. The SQL log file is written in clear text. By not producing a SQL log file, the sensitive data is not persisted to disk, which may satisfy security requirements for data at rest, such as those required to meet PCI compliance standards.
  • The compared or repaired tables have a very large number of out-of-sync rows. A log file of this size can consume a large amount of disk space.

To suppress the SQL log file, use the nosqllog option with the compare or repair command.

To suppress the output of the SQL log file for all compare and repair runs while the current instance of SharePlex is running, set the SP_SYS_SECURE_MODE environment variable to 1. This variable must be set before starting SharePlex, so if the sp_cop process is running it must be restarted after setting this variable. When sp_cop is run with this environment variable, the compare and repair commands will not put data into SQL files and the Post process will not put data into the SharePlex error log.

Run multiple processes

All of the compare and repair commands enable you to run multiple processes concurrently.

  • Multiple compare and repair commands can operate concurrently, each processing a pair of source and target tables, or you can use one command with PostgreSQL wildcards to specify multiple sets of tables. See the SharePlex Administration Guide for more information about how SharePlex supports wildcards.
  • The compare using and repair using commands operate on an entire file. For example, you can compare or repair the tables in an entire configuration file, or you can create one or more compare files or repair files to affect a subset of the target tables, and then run one or more of them concurrently. See the command syntax for instructions.

A maximum of 20 SharePlex processes can use the post queue at the same time, including the replication processes and the comparison and repair processes. It is recommended that you allow a maximum of five comparison and repair processes to run at any given time. By using the compare using and repair using commands, you can work around the 20-process limit by comparing more tables per process.

If a comparison or repair fails because the limit is reached, SharePlex logs a message to the Event Log.

Note: You can run multiple commands more easily by using the edit command to edit a previous command to create a new one.

Repair a subset of a configuration

You can repair subsets of an active configuration in the following ways.

  • To repair all of the target tables in replication that belong to one schema, use the repair command with a wildcard:

    sp_ctrl> repair scott.%

  • To repair all of the target tables in a configuration file, use the repair using command:

    sp_ctrl> repair using myconfig

  • To repair all of the target tables in one target route, use the repair using command with the at option:

    sp_ctrl> repair using config.active at prodsys@o.ora112 (Oracle source)

    sp_ctrl> repair using config.active at prodsys@r.dbid (PostgreSQL source)

  • To repair a custom subset of the tables in a configuration, specify them in a repair file. This is a plain text file that lists only the source tables whose targets you want to repair. The target tables are taken from the configuration file at the time that the command is issued. You can create a repair file by using the create config or copy config command. Make certain to give this file a name that makes it clear it is not a configuration file. See the command syntax for more information.

Control which rows are repaired

The compare and repair commands have where options that enable you to filter the rows that are selected for processing. By default, these commands affect all rows of a table and ignore columns in the target table that are not contained in the source table.

  • Use the where option to filter rows based on identically named columns in the source and target tables.

  • Use the where option for a table that uses vertically partitioned replication. The source and target columns can have different names. Base the where selection on the source columns. SharePlex reads the column mappings from the configuration file to build the correct WHERE clause for the target table.
  • Use the sourcewhere and targetwhere options if one or more extra columns exists in either the source or target table and those rows contain values that determine row uniqueness.

    • Use sourcewhere if the source table contains the extra columns.
    • Use targetwhere if the target table contains the extra columns.

    To use this option correctly:

    • Use a sourcewhere or targetwhere option only for the extra columns.
    • Use the standard where option for the other columns that have the same name on both source and target.

    • SharePlex combines the where option with the sourcewhere or targetwhere option to create the complete WHERE clause.

Important! If you plan to run both a comparison and repair for a target table that has extra rows, only use targetwhere to compare for UPDATEs and DELETEs. The repair command cannot determine the correct values for INSERTs. To work around this issue, set a default value for the extra columns or manually update the inserted rows.

Identify processes

Every time that a comparison or repair command is issued, the job ID is shown in the sp_ctrl display. If the sp_ctrl display is not available, you can view the job ID by running the compare status command.

View status and results in sp_ctrl

To view the status or results of a repair, use the repair status command in sp_ctrl.

  • The basic command displays the processing status of the most recently started repair job, as well as any other jobs that have not yet finished.
  • Additional options can be used to display a summary status for all repair jobs for which there is history, or to display detailed information about one job.

For more information, see Repair status.

View warnings and errors for Oracle to Oracle replication

The sp_desvr and sp_declt processes write a log file on the system where they run. The logs are stored in the log sub-directory of the SharePlex variable-data directory.

The name of the log written by the sp_desvr process is desvr_JobID_SID_pProcessID.log, where:

  • JobID is the SharePlex-assigned job ID.
  • SID is the ORACLE_SID of the Oracle instance where the source table resides.
  • ProcessID is the process ID of the sp_desvr process.

The names of the files written by the sp_declt process are declt_JobIDTableID_SID_SourceHost_pProcessID appended with either .log or .sql, where:

  • JobID is the SharePlex-assigned job ID for the job.
  • TableID is the SharePlex-assigned table ID for the table in the job.
  • SID is the ORACLE_SID of the Oracle instance where the source table resides.
  • SourceHost is the name or IP address of the source host.
  • ProcessID is the process ID of the sp_declt process.

Example log file names:

desvr_606_ora112_p14610.log

declt_606-1_ora112_prodsys_p6528.log

declt_606-1_ora112_prodsys_p6528.sql

To control disk usage, the logs are aged in a circular fashion. SharePlex generates a new log file when the current log reaches the size limit. New logs are created up to a maximum number of logs, and then SharePlex starts overwriting the oldest log.

View warnings and errors for Oracle to PostgreSQL and PostgreSQL as a source replication

The sp_xdesvr and sp_xdeclt processes write a log file on the system where they run. The logs are stored in the log sub-directory of the SharePlex variable-data directory.

The name of the log written by the sp_xdesvr process is xdesvr_<jobid>_r.<dbid>_p<process id>.log, where:

  • JobID is the SharePlex-assigned job ID.
  • DBID is the database ID of the PostgreSQL instance.
  • ProcessID is the process ID of the sp_xdesvr process.

The names of the files written by the sp_xdeclt process are xdeclt_<jobid>-<tableid>_r.<dbid>_p<processid>.log appended with either .log or .sql, where:

  • JobID is the SharePlex-assigned job ID for the job.
  • TableID is the SharePlex-assigned table ID for the table in the job.
  • DBID is the database ID of the PostgreSQL instance.
  • SourceHost is the name or IP address of the source host.
  • ProcessID is the process ID of the sp_xdeclt process.

Example log file names:

xdesvr_7_r.aparopka_p4970.log

xdeclt_7-1_r.aparopka_p25095.log

xdeclt_7-1_r.aparopka_p25095_01.sql

To control disk usage, the logs are aged in a circular fashion. SharePlex generates a new log file when the current log reaches the size limit. New logs are created up to a maximum number of logs, and then SharePlex starts overwriting the oldest log.

Cancel a repair job

Use the cancel command to stop a running comparison or repair job.

sp_ctrl(sysA)>cancel JOBID

For more information, see Cancel.

Manage compare history and logs

SharePlex retains a history of each finished job in the database on the source system. The SP_SYS_JOB_HISTORY_RETENTION parameter controls how long history is retained.

To clear this history on demand, use the clear history command. When SharePlex removes the history of a job, it also removes the log file that was the source of the history.

To remove the log files from the source system without clearing the job history from the database, use the remove log command. You can also use this command to remove old log files from the target system.

To control the size of the log files, set the SP_DEQ_LOG_FILESIZE parameter.

Control the batch size

You can control the size of the block of rows that is fetched when the process makes its SELECT query. The block size is calculated based on the value set with the SP_DEQ_MALLOC parameter. The value is divided equally by the number of comparison threads to be used, and then it is recalculated based on the size of all of the columns added together.

Usage

Supported source and target combinations: Oracle to Oracle, PostgreSQL to PostgreSQL, Oracle to PostgreSQL, PostgreSQL to Oracle
Authorization level: Operator (2)
Issues on: source system
Related commands: Compare / compare using

Syntax

Basic commands Command options Remote options
repair owner.source_table[.partition]

[ at target_host@o.target_sid ] | (applicable only for Oracle/PostgreSQL to Oracle)

[ for o.source_sid ] | (applicable only for Oracle to Oracle/PostgreSQL)

[hinthint”] | (applicable only for Oracle to Oracle/PostgreSQL)

[ at target_host@r.target_dbid ] | (applicable only for Oracle/PostgreSQL to PostgreSQL)

[ for r.source_dbid ] | (applicable only for PostgreSQL to Oracle/PostgreSQL)

[ {include | exclude} "column_list" ] |

[ insertonly ] |

[ key ] |

[ nosqllog ] |

[ not "exception_list" ] |

[ onepass ] |

[ orderby "column_list” ] |

[ parallelism degree ] |

[ port port_number ] | (applicable only for Oracle to Oracle)

[ sourcewhereclause” ] |

[ threads thread_count ] |

[ targetwhereclause” ] |

[ to target_owner.target_table[.partition] ] |

[ whereclause” ]

[ on host |

on host:portnumber |

on login/password@host |

on login/password@host:portnumber ]

repair using filename

[ key ] |

[ onepass ] |

[ port port_number ] |

[ threads threads_count ] |

[ parallelism degree ]

[ on host |

on host:portnumber |

on login/password@host |

on login/password@host:portnumber ]

Syntax description
Required command components
Component Description
repair owner.source_table[.partition]

The basic command repairs all of the source rows with all of the target rows.

owner.source_table is the owner and name of the source table. Use double quotes to enforce case-sensitivity or spaces within a name, for example “HR”.emp.

Wildcarded table names (but not owner names) are supported. To be repaired, tables that satisfy a wildcard in this command must be listed (explicitly or by wildcard) in the active replication configuration. For more information about how SharePlex handles wildcards, see the SharePlex Administration Guide.

Example

sp_ctrl(sysA)>repair scott.emp

When running a repair from the command line of the operating system, if the table name is case-sensitive, quoted strings must include an extra set of escaped double quotes.

For example, if the table name is Dt_TOtalS1, the repair command should be:

splex_install/bin/./sp_ctrl repair splex."\"Dt_TOtalS1\""

repair using filename

The basic command repairs all of the out-of-sync rows in the target tables listed in filename.

filename is the name of the file that contains the names of the source tables whose targets you want to repair.

Example

sp_ctrl(sysA)>repair using sales

Optional command components
Component Description
at target_host@o.target_sid (applicable only for Oracle to Oracle)

Valid for repair

Repairs only one of the target tables in a configuration where the source table replicates to multiple target systems.

target_host is the name of the target system.

target_sid is the ORACLE_SID of the target Oracle instance.

Example

sp_ctrl(SysA)>repair scott.emp at prod@o.prodsid

for o.SID (applicable only for Oracle to Oracle)

Valid for repair

Specifies the Oracle instance that contains the source table. Use when the same source table is in multiple Oracle instances on a system.

SID is the ORACLE_SID of the source instance. It is case-sensitive and must be typed as it appears in the oratab file or V$PARAMETER table, or Windows Registry.

When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example

sp_ctrl (SysA)>repair scott.emp for o.oraA

at target_host@r.target_database_name (applicable only for PostgreSQL as a source)

Valid for repair

Repairs only one of the target tables in a configuration where the source table replicates to multiple target systems.

target_host is the name of the target system.

target_db is the name of the target database name.

Example

sp_ctrl(SysA)>compare scott.emp at prod@r.database_name

for r.DBID (applicable only for PostgreSQL as a source)

Valid for compare

Specifies the PostgreSQL instance that contains the source table. Use when the same source table is in multiple PostgreSQL instances on a system.

DBID is the database name of the PostgreSQL source instance. It is case-sensitive and must be typed as it appears in the config file.

When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example

sp_ctrl (SysA)>compare scott.emp for r.database_name

{include | exclude} "(column_list)"

Valid for repair

Filters the columns to be repaired.

  • Use include to specify columns that you want to repair. No other columns are repaired. You must include all of the key columns in an include clause.
  • Use exclude to repair all columns except those specified with exclude. Do not exclude any key columns.

(column_list) is the list of columns to include or exclude.

  • Separate each name with a comma. No spaces are permitted in the list unless the name of a column contains spaces.
  • Enclose the column list within double quote marks.
  • List columns in any order. The sort is performed in ascending order.
  • Column names are not case-sensitive.
  • When used, this option must appear after the required arguments of the command, but it can appear in any order with other options.

Note: There could still be rows that are out-of-sync in the columns that were not repaired.

Example

sp_ctrl (SysA)>repair scott.emp exclude "color, weight"

hint "hint" (applicable only for Oracle to Oracle/PostgreSQL)

Valid for repair

Includes an Oracle hint in the SELECT statement. The hint is used on the source and target systems.

hint” is a standard Oracle hint no longer than 2000 characters. Enclose the entire hint within double quotes. Omit the leading /*+ and trailing */ in the hint string. They are added by SharePlex.

When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example

sp_ctrl (SysA)>repair scott.emp where “file >001005” hint “emp(salary)”

When running a repair from the command line of the operating system, quoted strings must have an extra set of escaped double quotes:

/productdir/bin/sp_ctrl repair scott.emp hint “\“emp(salary)\””

Note: The Hint component is not supported in PostgreSQL by default. To enable this feature on PostgreSQL, users must configure the following parameters:
  • SP_DEQ_PG_FORCE_PARALLEL

  • SP_DEQ_PG_PARALLEL_MAX

  • SP_DEQ_PG_PARALLEL_SETUP_COST

  • SP_DEQ_PG_PARALLEL_TUPLE_COST

insertonly

Valid for repair

Repairs the target table for INSERT statements only.

Example:

sp_ctrl(SysA)>repair scott.emp insertonly

key

Valid for repair and repair using

Performs a fast compare and repair of large tables. This command does not compare all of the data values, but only compares one of the following:

  • Only the PRIMARY key or non-null UNIQUE key columns.

    Or...

  • The columns specified with the orderby option. Use this option if the tables have no keys.

If the key or orderby columns do not match, SharePlex repairs the entire row by deleting it and then inserting it again based on the source values.

Note: The repair command does not support the key and onepass options being used together.

Example: repair <schema name>."<Table name>" onepass key

Important! Use this option with caution. Even if key values match, it is possible for values in non-key columns to be out of synchronization.

When used, this option must appear after the required command arguments. It can appear in any order with other options.

Do not use this option to base a repair on a SharePlex key definition. For more information about SharePlex key definitions, see the SharePlex Administration Guide.

Example

sp_ctrl (SysA)>repair scott.emp key

sp_ctrl(sysA)>repair using sales key

nosqllog

Suppresses output of the SQL log file. This file contains the SQL that is needed to repair out-of-sync rows. Some reasons not to output this file include:

  • The data contains sensitive information. The SQL log file is written in clear text. By not producing a SQL log file, the sensitive data is not persisted to disk, which may satisfy security requirements for data at rest, such as those required to meet PCI compliance standards.
  • The compared or repaired tables have a very large number of out-of-sync rows. A log file of this size can consume a large amount of disk space.
notexception_list

Valid for repair

Specifies an exception list of tables not to repair when the table specification includes wildcards.

exception_list” is a list of names of the tables not to repair.

  • Use the owner.tablename format.
  • Separate each name with a comma. No spaces are permitted in the list.
  • Enclose the list within double quote marks.
  • List the tables in any order.
  • When used, this option must appear after the required arguments of the command, but it can appear in any order with other options.

Example

sp_ctrl(SysA)>repair scott.% not (%temp%)

onepass

Valid for repair and repair using

Use this option to run a compare and repair concurrently. Use it for large out-of-sync tables.

Note: The repair command does not support the key and onepass options being used together.

Example: repair <schema name>."<Table name>" onepass key

Normally, a repair runs in two passes: first a compare, then a repair, which locks the target table. Both passes require a consistent view. With onepass, the target table is locked and repaired as soon as the compare client receives the consistent view marker.

Example

sp_ctrl(SysA)>repair scott.emp onepass

Note: For PostgreSQL, if a table has more than one key defined, using the 'onepass' command option may result in a duplicate constraint violation error during the repair process. It is recommended not to use the 'onepass' command option for such tables, as repair will work correctly without it.

For tables with a single key defined, repairing with the 'onepass' option will also work correctly.

In the case of a table with no key defined in a PostgreSQL database, the 'onepass' option should be used for repair if there are duplicate records. Additionally, UPDATE or DELETE statements may not work accurately because the WHERE clause can affect more rows than intended.

orderbycolumn_list

Valid for repair

Use the ORDERBY clause command option in conjunction with the KEY command option to compare the columns specified with the ORDERBY option. If the key or ORDERBY columns do not match, SharePlex repairs the entire row by deleting it and then inserting it again based on the source values.

Specifies columns for the repair process to use in its ORDERBY clause when it sorts rows to be compared. This option enables repairs to be performed on tables that have no primary or unique key.

column_list” is the names of the columns to use in the ORDERBY clause.

  • Separate each name with a comma. No spaces are permitted in the list unless the name of a column contains spaces.
  • Enclose the column list within double quote marks.
  • List columns in any order. The sort is performed in ascending order.
  • Column names are not case-sensitive.
  • When used, this option must appear after the required arguments of the command, but it can appear in any order with other options.
  • When running a repair from the command line of the operating system, quoted strings must have an extra set of escaped double quotes:

    /productdir/bin/sp_ctrl repair scott.emp orderby “\“Last Name,Division\””

Example

sp_ctrl(SysA)>repair scott.emp where “file >001005” orderby “Last Name,Division”

parallelism degree

Valid for repair and repair using

Adds a parallel hint to the SELECT statement. For degree, set the degree of parallelism.

Example

sp_ctrl(sysA)>repair scott.emp parallelism 4

sp_ctrl(sysA)>repair using sales parallelism 4

port port_number (applicable only for Oracle to Oracle)

Valid for repair and repair using

Available for backward compatibility if the version of SharePlex is earlier than 8.0 on the source or target system.

Specifies a port on the source system for the client process to use for communication with the server process. In earlier versions of SharePlex, the communication is two-way, and a random port number is selected by default for client-to-server communication. This option overrides the random port selection with a specific port number, such as that required by a firewall.

Example

sp_ctrl(sysA)>compare scott.emp port 1234

sourcewhereclause

Valid for repair

Bases the repair on one or more columns in the source table when those columns do not exist in the target table. Rows filtered by this condition on the source table will be locked.

  • Enclose clause within double quote marks and refer to tables by their fully qualified names, for example scott.emp.
  • Use double quote marks to enforce case sensitivity or spaces within a table name.
  • Dates must be in the format of 'YYYYSMMDDHH24MISS'. To convert a date to that format, use the PostgreSQL TO_DATE function. For example if c1 is a DATE column, the WHERE clause "c1 > '10-SEP-2001'" will not work, but "c1 > to_date('10- SEP-2001', 'DD-MON-YYYY')" will work.
  • When running a repair from the command line of the operating system, quoted strings must have an extra set of escaped double quotes, like the following example:

    sp_ctrl>repair scott.emp sourcewhere “\“file >001005\””

  • When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example #1:

sp_ctrl(sysA)>repair scott.emp sourcewhere “file >001005”

Example #2:

The following example shows how the sourcewhere and where options are combined to get the desired result. Only the source repair process uses the sourcewhere clause, but both the source and target repair processes use the where clause.

sp_ctrl(SysA)>repair scott.emp sourcewhere “deptno = 200” where “mgr = ‘SMITH’”

targetwhere "clause"

Valid for repair

Bases the repair on one or more columns in the target table when those columns do not exist in the source table. Rows filtered by this condition on the target table will be locked.

  • Enclose the clause within double quote marks and refer to tables by their fully qualified names, for example scott.emp.
  • Use double quote marks to enforce case sensitivity or spaces within a table name.
  • Dates must be in the format of 'YYYYSMMDDHH24MISS'. To convert a date to that format, use the PostgreSQL TO_DATE function. For example if c1 is a DATE column, the WHERE clause "c1 > '10-SEP-2001'" will not work, but "c1 > to_date('10- SEP-2001', 'DD-MON-YYYY')" will work.
  • When running a comparison from the command line of the operating system, quoted strings must have an extra set of escaped double quotes:

    /productdir/bin/sp_ctrl repair scott.emp targetwhere “\“file >001005\””

  • When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example #1:

sp_ctrl(SysA)> repair scott.emp targetwhere “file >001005”

Example #2:

The following example shows how the targetwhere and where options are combined to get the desired result. Only the target repair process will use the targetwhere clause, but both the source and target repair processes will use the where clause.

sp_ctrl(SysA)>repair scott.emp where “deptno = 200” targetwhere “mgr = ‘SMITH’” repair

threads thread_count

Valid for repair and repair using

Sets the number of processing threads that are used by the repair process.

Example

sp_ctrl(sysA)>repair scott.emp threads 4

sp_ctrl(sysA)>repair using sales threads 4

to target_owner.target_table [.partition]

Valid for repair

Repairs only one of the targets of a source table. Use when the source table replicates to multiple target systems and the target tables have different names.

This option can also be used to specify a target partition.

compare source_owner.source_table.[source_partition] to target_owner.target_table.[target_partition]

Example

(Repairs a partition)

sp_ctrl(SysA)>repair scott.emp.east to scott.allemp.alleast

whereclause

Valid for repair

Include a WHERE clause in the SELECT statement on both the source and target systems. The WHERE clause acts as a filter to repair specific rows. Rows filtered by this condition will be locked.

For “clause” specify a standard WHERE clause that does not include subqueries.

  • Enclose the clause within double quote marks and refer to tables by their fully qualified names, for example scott.emp.
  • Use double quote marks to enforce case sensitivity or spaces within a table name.
  • Dates must be in the format of 'YYYYSMMDDHH24MISS'. To convert a date to that format, use the PostgreSQL TO_DATE function. For example if c1 is a DATE column, the WHERE clause "c1 > '10-SEP-2001'" will not work, but "c1 > to_date('10- SEP-2001', 'DD-MON-YYYY')" will work.
  • When used, this option must appear after the required command arguments, but it can appear in any order with other options.

Example

sp_ctrl (SysA)>repair scott.emp where “region=4”

Remote options

These options enable you to issue the command on a remote machine and to script commands that include a login name, password, port number, or combination of those items.

Option Description
on host

Execute the command on a remote system (one other than the one where the current sp_ctrl session is running). You are prompted for login credentials for the remote system. If used, must be the last component of the command syntax.

Example:sp_ctrl(sysB)>status on SysA

on host:portnumber

Execute the command on a remote system when a remote login and port number must be provided. If used, must be the last component of the command syntax.

Example:sp_ctrl(sysB)>status on SysA:8304

on login/password@host

Execute the command on a remote system when a remote login, password, and host name must be provided. If used, must be the last component of the command syntax.

Example:sp_ctrl(sysB)>status on john/spot5489@SysA

on login/password@host:portnumber

Execute the command on a remote system when a remote login, password, host name, and port number must be provided. If used, must be the last component of the command syntax.

Example:sp_ctrl(sysB)>status on john/spot5489@SysA:8304

Copy/Append

The copy/append command allows users to set up replication and/or (re)synchronize individual tables. This section explains how users can copy or append data from Oracle to various supported on-premises or Cloud platforms.

Copy/Append for Oracle to Oracle

The copy/append command uses the Oracle Export/Import utility to allow users to set up replication and/or (re)synchronize individual tables already in replication.

Users may copy/append individual tables to a single target, specify multiple targets, or all targets in the replication configuration.

Important:
  • This command invokes Export with CONSISTENT=Y. This requires an adequately sized RBS to avoid an ORA-01555 error.
  • This command cannot be used in a bi-directional or high availability environment without additional steps. Refer to the Knowledge Base solution 48020.
  • Before you use this command, review all of this documentation. Improper use could result in lost data and out-of-sync conditions.
  • Ensure that the Oracle Database TEMP tablespace is configured to auto-extend.

The copy command

Use the copy command to synchronize or instantiate a table (or tables) from one host to any other host when you want the target table truncated prior to synchronizing data.

The append command

Use the append command to synchronize or instantiate a table (or tables) from one host to any other host when you do not want the target table truncated prior to synchronizing data.

When to use the copy/append command

Use the copy/append command in the following ways:

  • To migrate a database.
  • To sync a table that the Compare/Repair process is unable to repair.
  • Place a table into replication while instantiating it.
What the copy/append command supports

The copy/append command supports the following:

  • Objects supported by the copy/append command are those objects supported by Oracle’s Import/Export utility.
  • Copying from a lower version of Oracle to a higher version of Oracle, or between the same versions of Oracle.
  • The copy/append of objects in a synchronization routing file that are included as a result of Oracle wildcard specification.
  • The use of Oracle wildcard specification in command line syntax.
What the copy/append command does not support

The copy/append command does not support:

  • Copying from a higher version of Oracle to a lower version of Oracle
  • Copying from a table to a view
  • UDTs or VARRAYs if the UDT or VARRAY type was not created on the target database using Oracle's Import/Export utility or Oracle's hot backup. This is a limitation in Oracle's import/export facility
  • Tables in replication that are horizontally or vertically partitioned
  • Sequences
  • Tables for which transformation is being used, unless the transformation is being applied on the target, as well
  • Network configurations in which a pass-through server is used to pass data between the source and target servers
  • Column mapping
  • Subset of columns
  • Specifying a subset of rows within a table
  • Indexes, constraints, triggers, and grants options
  • Direct load
  • Transparent Data Encryption (TDE)
  • The append command does not support Oracle partitions. (Only the copy command supports Oracle partitions.)

  • On Oracle Database 23c, the Copy/Append command isn't supported with encrypted table space.

  • The BINARY DOUBLE and the BINARY FLOAT data types are not supported for the copy/append command.

  • If a configuration file has different table names on the source and target, and the target contains another table with the same name as the source, using the copy/append command may compromise the consistency of the data already present in the target table. It is important to note that in such cases, the copy/append command will not rename the table on the target. The copy status detail command will display a message in sp_ctrl that "Cannot rename table on target; source name exists".

Important:
  • The copy/append command supports Oracle wildcards; however, if the set of objects indicated by the wildcard specification includes objects that are not presently in replication, the copy/append command will only act on those objects currently in replication.
  • If the force option is employed and all the target information is specified, the tables in replication will be copied statically, as is the current behavior.

The launcher process

The launcher process must be running on the target system(s) prior to executing the copy/append command. To start the launcher process the user must execute the following command on each of the target systems:

sp_ctrl(sysB)> start launcher

While the launcher process is running the show launcher command may be used to view process details.

When the user has completed synchronization the launcher may be stopped on the target system(s). To stop the launcher process the user must execute the following command on each of the target systems:

sp_ctrl(sysB)>stop launcher

Overview of copy/append process

The copy/append command initiates a process to synchronize individual tables between individual hosts.

The following is the sequence of events that illustrates simple synchronization process activity:

  1. Log onto the target system and issue the start launcher command from sp_ctrl.
  2. When the copy/append command is issued from a sp_ctrl session the sp_cnc spawns sp_sync_svr on the source system.
  3. The sp_sync_svr connects to the target system and starts the sp_sync_clnt on the target system.
  4. The sp_sync_svr sends the sp_syn_clnt a table list to verify information on the target table. a) If the object is being copied (versus an append) the target table is truncated.
  5. For each object under copy the sp_sync_svr starts up an Oracle export process.
  6. If the object under copy is in replication sp_sync_svr must wait for sp_sync_clnt to indicate that the Post process is ready.
  7. The sp_sync_clnt process starts an Oracle import process for each of the objects that the sp_sync_svr process opened an Oracle export process for.
  8. The sp_sync_svr process transfers data to the sp_sync_clnt process until the copy is complete.
  9. If the object under copy is in replication the Post process re-initiates and resumes it’s posting activities.
  10. Log onto the target system and issue the stop launcher command from sp_ctrl.

Running concurrent copy processes

You can issue multiple copy/append commands at a time. Users should note that while the copy process is in progress the Post process stops all replication.

Identifying synchronization processes

The synchronization processes are not listed in the sp_ctrl console as they are not started by sp_cop process. To identify the process use your operating system to locate the executables.

  • sp_sync_svr
  • sp_sync_clnt

  • sp_sync_lstnr

  • sp_sync_launcher

Tuning parameters for the synchronization

The following is a list of parameters associated with synchronization using the copy/ append command. These parameters are all live and take effect the next time the command is issued.

  • SP_OSY_COMPRESSION: This parameter adjusts the data compression from off (0) to full (9). The default integer value is set to six (6).
  • SP_OSY_EXP_BUFFER_SIZE: This parameter adjusts the amount of data that is buffered before being sent to the target system. The default integer value is 1024 Kilobytes.
  • SP_OSY_IMP_BUFFER_SIZE: This parameter adjusts the amount of data that is buffered before being applied on the target system. The default integer value is 1024 Kilobytes.
  • SP_OSY_LOCK_TIMEOUT: This parameter set the number of seconds that the synchronization process will wait to obtain a table lock. The default integer value is 2 seconds.
  • SP_OSY_PORT: This parameter sets the port number for the synchronization process. The default integer value is set to port number 2501.
  • SP_OSY_POST_TIMEOUT: This parameter sets the number of seconds that the synchronization process will wait for the Post process to be ready and the synchronization to begin. The default integer value is set to 1800 seconds (30 minutes).
  • SP_OSY_TCP_TIMEOUT: This parameter sets the number of seconds for the IPC time-out. The default integer value is set to 60 seconds.
  • SP_OSY_THREADS: This parameter sets the number of synchronization processing threads. This thread parameter only affects a partitioned table. The default integer value is set to 5 threads. It has a maximum value of 32 threads.

Viewing copy status

The best way to view the status of one or more copy/append commands is to use the copy status command or the append status command. The basic command displays the results of all copy/append processes on a system.

The basic command displays the status of all copy/append jobs currently running on the system, and the most recently executed copy/append if it isn’t included in the currently running list. This list can be filtered to show only a specified status.

The best way to view the results of one or more copy/append commands is to use the report command with the copy option in sp_ctrl.

In the example text that follows, the copy/append command was issued against a table not in replication. The copy status that follows displays basic information about the table and the status of the procedure.

sp_ctrl (alvlabl17:8708)> copy sp_iot.SYNC_iot_BASIC to sp_iot.SYNC_iot_BASIC for o.w920a32f at irvqasu15@o.a102u64f force

copy started; job id 111

sp_ctrl (alvlabl17:8708)> copy status 111 for o.w920a32f

Job ID : 111

Host : alvlabl17.quest.com

Started : 17-MAR-08 13:59:28

Job Type : Copy

Status : Done

ID Tablename Total rows %Comp Status Status time Total time
--- ------------------------- ----------- -------- -------- ----------- ----------
1 "SP_IOT"."SYNC_IOT_BASIC1" 3720 100 Done N/A 0:08
2 "SP_IOT"."SYNC_IOT_BASIC2" 3720 100 Error N/A 0:08
3 "SP_IOT"."SYNC_IOT_BASIC3" 3720 100 Done N/A 0:08

To filter this list to only show the tables with a status of error, execute the following command:

sp_ctrl (alvlabl17:8708)> copy status 111 for o.w920a32f “Error”

Using a synchronization routing file

The synchronization routing file is very similar in structure to a configuration file used for activation, in that the file contents have the same formatting requirements. The difference between the two files is that some tables or objects in a configuration file may not be supported by the synchronization process and therefore should not be included in a synchronization routing file. For example, horizontally or vertically partitioned tables are not supported by the synchronization process and should not be included in a synchronization routing file.

Use of Oracle wildacrds in synchronization routing files is supported. The application of Oracle wildcards in a synchronization routing file is the same as in a config file. For information about how SharePlex supports wildcards, see the SharePlex Administration Guide.

Example routing file
Datasource:o.s_sid1
s_user0.sync_multi_trgt d_user0.sync_multi_trgt d_host1@o.d_sid1
s_user0.sync_multi_trgt d_user0.sync_multi_trgt d_host2@o.d_sid1
s_user0.sync_multi_trgt d_user0.sync_multi_trgt_bu d_host1@o.d_sid2
Notes:
  • When using the copy/append command for a group of tables all the tables must be in replication or all the tables must not be in replication. If you have a combination of tables in replication and tables not in replication the user must create a separate synchronization routing file for each group and a separate synchronization process be started with each file.
  • The copy/append command copies tables in random order and does not take into account referential integrity. Therefore, we recommend that users copy/append only one table at a time, or limit the copy/append to a very small number of tables.

Copying dissimilar source and target tables

The structure of the source and target table(s) should be identical, with the exception that the source tables may contain less columns than the target tables.

The copy/append command should not be used for source tables that contain more columns than their corresponding target tables.

Using copy with partitioned replication

When tables in a configuration use partitioned replication:

  • The copy/append command will support the copying of individual tables and individual partitioned tables, but not individual partitions.
  • Data is never copied to an individual partition, even when the target object specified is a partition.
  • Specifying a partition as a target is not supported.
  • The synchronization of data, for both, copy and append, is always done on the base table and never the partition.
  • The copy/append command does not support vertically or horizontally partitioned tables currently in replication.
  • Using the option, [singlethread], a partitioned table will be copied as one object. The default behavior is to copy each partition of a partitioned table separately so that the copy can be done in parallel.

Controlling the number of processing threads

To take advantage of machines with multiple processors, you can set the number of copy/append processing threads on the source system using the SP_OSY_THREADS parameter. This thread parameter only affects a partitioned table. The default value of this parameter is set to five (5) threads, and the range of valid values is from 1 to 32 threads.

Please note that synchronization process is single threaded when the tables are in replication. Multi-threaded processing only comes into play with tables that are not in replication.

Using Oracle wildcards in command line syntax

Oracle wildcards may be employed when specifying the source_table portion of the copy/append command. Additionally, you may use not notation to exclude specific objects.

You may specify all the tables in a specific schema using the following:

sp_ctrl (irvspxu14:8567)> copy scott.%

In the above example, all objects under the scott schema will be copied, provided the objects are currently in replication.

You can also set exclusions using the following:

sp_ctrl (irvspxu14:8567)> copy scott.% not (%"foo"%)

In the above example, all objects under the scott schema, except objects whose name contain “foo”, will be copied, provided the objects are currently in replication.

For more information about how SharePlex supports wildcards, see the SharePlex Administration Guide.

Other considerations for using copy/append

  • When using the copy/append command to sync a table that is out-of-sync or when using the copy/append command to place a table into replication while instantiating it the Post process will pause while the table is being copied. The Post process will resume when the copy/append command is complete. This does not apply to a table that is being added to replication through a new route.
  • The copy/append command can only operate on one table at a time if the tables are currently in replication.
  • When using the copy/append command for a table not in a known replication route the user must employ the force option. To employ copy/append on objects not in replication the user must employ the force option.
  • When using the copy/append command for a table in replication, all SharePlex processes (Capture, Read, Export, Import, Post) must be running when you issue the copy/append command, and they must remain running throughout the processes.
  • Do not use the copy/append command in a cascading replication environment.
  • Tables with foreign keys should have those keys disabled and then re-enabled.
  • Table indexes, constraints, triggers, and grants must be (re)enabled after the synchronization completes, as these options are not supported.
  • When objects are in replication copy/append does not require locks or synchronization between the source table and target table since it is assumed that the source and target table will not undergo changes while the copy/append command is being executed.
  • When a config file is specified, which contains multiple objects, the source and target schema name can only be different if all of the target objects have the same schema name.

  • The copy/append command will only be able to copy or append data between two objects on the same database if the objects reside in different schemas.
  • Activating a new config while the copy/append process is running may cause the synchronization process to fail.

Note: The syntax for the copy and append commands are exactly the same. The examples that appear below utilize the copy command, but the append command can be invoked by simply substituting append for copy.

Usage

Supported sources: Oracle
Supported targets: Oracle
Authorization level: Operator (2)
Issues on: source system
Related commands: None

Syntax

Basic command Command options Remote options

{copy | append} source_owner.source_table

 

[not (list of exceptions)]

[totarget_owner.target_table[.partition]]

[at target_host[@target_SID]

[for o.source_SID]

[singlethread]

[force]

[status]

[ on host |

on host:portnumber |

on login/password@host |

on login/password@host:portnumber ]

{copy | append} using filename

[for o.source_SID]

[force]

[ on host |

on host:portnumber |

on login/password@host |

on login/password@host:portnumber ]

Syntax description
Component Description

source_owner.source_table

Specifies an individual source owner and source table name or a group of objects using wildcards. Not valid if using {copy | append} with the usingfilename syntax.

When used without the totarget_owner.target_table option, this syntax assumes that the synchronization target is the same as the replication target.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl

sp_ctrl(sysA)>append s_user1.sync_single_tbl

filename

The name of a synchronization routing file containing the tables to be synchronized. File names are case-sensitive.

Use this option when using the {copy | append} using command.

Example:

sp_ctrl(SysA)>copy using sync_file_2.txt

sp_ctrl(sysA)>append using sync_file_2.txt

[not (list of exceptions)]

Specifies an exception list of tables not to be copied/appended when the table specification includes wildcards.

The exception_list is a list of table names that should not be copied/appended.

Consider three tables: copytest1, copytest2, and copytest3. In the example below, only the data from the copytest3 table is copied to the target.

sp_ctrl > copy s_user1.% not (copytest1,copytest2)

totarget_owner.target_table [.partition]

Specifies the target table for synchronization. This option only valid with the source_owner.source_table option.

If the table is not in replication, use this option in conjunction with the attarget_host@ [target_sid] option.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl to d_user1.sync_single_tbl

sp_ctrl(SysA)>append s_user1.sync_single_tbl to d_user1.sync_single_tbl

attarget_host@ [target_SID]

Specifies the location of the target table for synchronization. Use in conjunction with the totarget_owner.target_table [.partition] option.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl to d_user1.sync_single_tbl at d_host1@o.d_sid1

sp_ctrl(SysA)>append s_user1.sync_single_tbl to d_user1.sync_single_tbl at d_host1@o.d_sid1

foro.source_SID

Use to specify the datasource that contains the objects to be synchronized, if there is no active configuration, or if there are more than one active configurations.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl for o.source_sid at target_host@o.target_sid force

sp_ctrl(SysA)>append s_user1.sync_single_tbl for o.source_sid at target_host@o.target_sid force

singlethread Use this option to copy a partitioned table as one object. The default behavior is to copy each partition of a partitioned table separately so that the copy can be done in parallel.
force

Use this option when tables intended for synchronization are not in replication or when the table route does not match an existing or known route.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl at target_host@o.target_sid force

sp_ctrl(SysA)>append s_user1.sync_single_tbl at target_host@o.target_sid force

status

Displays status history for previous copy/append commands.

sp_ctrl(SysA)>copy status

sp_ctrl(SysA)>append status

Remote options

These options enable you to issue the command on a remote machine and to script commands that include a login name, password, port number, or combination of those items.

Option Description
on host

Execute the command on a remote system (one other than the one where the current sp_ctrl session is running). You are prompted for login credentials for the remote system. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on SysA

on host:portnumber

Execute the command on a remote system when a remote login and port number must be provided. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on SysA:8304

on login/password@host

Execute the command on a remote system when a remote login, password, and host name must be provided. If used, must be the last component of the command syntax.

Example:sp_ctrl(sysB)>status on john/spot5489@SysA

on login/password@host:portnumber

Execute the command on a remote system when a remote login, password, host name, and port number must be provided. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on john/spot5489@SysA:8304

copy/append

Copy/Append - Oracle to PostgreSQL

The copy/append command allows users to set up replication and/or (re)synchronize individual tables. It requires an ODBC configuration for the Oracle database.

Users may copy/append individual tables to a single target, specify multiple targets, or all targets in the replication configuration.

Important: Before you use this command, review all of this documentation. Improper use could result in lost data and out-of-sync conditions.

The copy command

Use the copy command to synchronize a table (or tables) from one host to any other host when you want the target table truncated prior to synchronizing data.

The append command

Use the append command to synchronize a table (or tables) from one host to any other host when you do not want the target table truncated prior to synchronizing data.

When to use the copy/append command

Use the copy/append command in the following ways:

  • To migrate a database.
  • To sync a table that the Compare/Repair process is unable to repair.
What the copy/append command supports

The copy/append command supports the following:

  • Table objects supported by the copy/append command.
  • The copy/append of objects in a synchronization routing file that are included as a result of wildcard specification.
  • The use of wildcard specification in command line syntax.
  • Tables in replication that are horizontally or vertically partitioned
  • Transparent Data Encryption (TDE)
  • Specifying a subset of rows within a table

What the copy/append command does not support

The copy/append command does not support:

  • Data types that are not supported by SharePlex replication between the source and target

  • Tables using transformation, unless the transformation is also being applied on the target

  • Network configurations where a pass-through server is used to transfer data between the source and target servers

  • Sequences, indexes, constraints, triggers, and grants options

Data synchronization architecture

This diagram illustrates a multi-threaded architecture for synchronizing data between a source and a target system.

Overview of copy/append process

The copy/append command initiates a process to synchronize individual tables between individual hosts.

The following is the sequence of events that illustrates simple synchronization process activity:

  1. Log onto the target system and issue the start launcher command from sp_ctrl.
  2. When the copy/append command is issued from an sp_ctrl session, sp_cnc spawns sp_xsync_svr processes on the source system. The number of processes spawned equals the value of the SP_XSY_PROCESSES parameter.
  3. Each sp_xsync_svr process handles one table at a time.

  4. The sp_xsync_svr connects to the target sp_cop system and starts the sp_xsync_clt on the target system.
  5. The sp_xsync_svr sends parameter information and table metadata to sp_xsync_clt.
  6. If the object being copied is under replication, sp_xsync_clt must wait until it receives the sync marker. The Post process thread should wait until the table copy is complete.

  7. The sp_xsync_svr process transfers data to the sp_xsync_clt process until the copy is complete.

  8. If the object being copied is under replication, the Post process thread re-initiates and resumes its posting activities.

Running concurrent copy processes

You can issue multiple copy/append commands at a time. Users should note that while the copy process is in progress the Post process stops all replication for the tables being copied/appended.

Identifying synchronization processes

The synchronization processes are listed in the sp_ctrl console as they are started by sp_cop process. To identify the process use your operating system to locate the executables.

  • sp_xsync_svr

  • sp_xsync_clt

Tuning parameters for the synchronization

The following is a list of parameters associated with synchronization using the copy/ append command. These parameters are all live and take effect the next time the command is issued.

  • SP_XSY_COMPRESSION: This parameter adjusts the data compression from off (0) to full (22). The default integer value is set to three (3).
  • SP_XSY_BUFFER_SIZE: This parameter adjusts the amount of data that is buffered before being sent to the target system. The default integer value is 500 MB.
  • SP_XSY_POST_TIMEOUT: This parameter sets the number of seconds that the synchronization process will wait for the Poster process to be ready and the synchronization to begin. The default integer value is set to 1800 seconds (30 minutes).
  • SP_XSY_READ_BUFFER_SIZE: This parameter adjusts the amount of data that is buffered before being sent to the target system for advanced data types. The default integer value is 1 MB.
  • SP_XSY_SVR_THREADS: This parameter sets the number of threads in the sp_xsync_svr process. The default integer value is 2 threads.
  • SP_XSY_CLT_THREADS: This parameter sets the number of threads in the sp_xsync_clt process. The default integer value is 2 threads.

  • SP_XSY_PROCESSES: This parameter sets the number of sp_xsync_svr processes to be created. The default integer value is 2 processes.
  • SP_XSY_LOG_FILESIZE: This parameter controls the maximum log file size. The default integer value is 50 MB.

  • SP_XSY_LOG_NUMFILES: This parameter controls the number of log files before rolling over. The default integer value is 3 files.

  • SP_XSY_SYNC_DEBUG: This parameter is used to adjust the debug levels for logging. The default value is 0x00000000.

Viewing copy status

The best way to view the status of one or more copy/append commands is to use the copy status command or the append status command. The basic command displays the results of all copy/append processes on a system.

The basic command displays the status of all copy/append jobs currently running on the system, and the most recently executed copy/append if it isn’t included in the currently running list. This list can be filtered to show only a specified status.

The best way to view the results of one or more copy/append commands is to use the report command with the copy option in sp_ctrl.

In the example text that follows, the copy/append command was issued against a table not in replication. The copy status that follows displays basic information about the table and the status of the procedure.

sp_ctrl (alvlabl17:8708)> copy sp_iot.SYNC_iot_BASIC to sp_iot.SYNC_iot_BASIC for o.w920a32f at irvqasu15@o.a102u64f force

copy started; job id 111

sp_ctrl (alvlabl17:8708)> copy status 111 for o.w920a32f

Job ID : 111

Host : alvlabl17.quest.com

Started : 17-MAR-08 13:59:28

Job Type : Copy

Status : Done

ID Tablename Total rows %Comp Status Status time Total time
--- ------------------------- ----------- -------- -------- ----------- ----------
1 "SP_IOT"."SYNC_IOT_BASIC1" 3720 100 Done N/A 0:08
2 "SP_IOT"."SYNC_IOT_BASIC2" 3720 100 Error N/A 0:08
3 "SP_IOT"."SYNC_IOT_BASIC3" 3720 100 Done N/A 0:08

To filter this list to only show the tables with a status of error, execute the following command:

sp_ctrl (alvlabl17:8708)> copy status 111 for o.w920a32f “Error”

Using a synchronization routing file

The synchronization routing file is very similar in structure to a configuration file used for activation, in that the file contents have the same formatting requirements. The difference between the two files is that some tables or objects in a configuration file may not be supported by the synchronization process and therefore should not be included in a synchronization routing file. For example, horizontally or vertically partitioned tables are not supported by the synchronization process and should not be included in a synchronization routing file.

Use of wildacrds in synchronization routing files is supported. The application of wildcards in a synchronization routing file is the same as in a config file. For information about how SharePlex supports wildcards, see the SharePlex Administration Guide.

Example routing file
Datasource:o.s_sid1
"S_SCHEMA0"."SYNC_MULTI_TRGT" "d_schema0"."sync_multi_trgt" d_host1@r.d_dbid1
"S_SCHEMA0"."SYNC_MULTI_TRGT" "d_schema0"."sync_multi_trgt" d_host2@r.d_dbid1
"S_SCHEMA0"."SYNC_MULTI_TRGT" "d_schema0"."sync_multi_trgt_bu" d_host1@r.d_dbid2
Note: The copy/append command copies tables in random order and does not take into account referential integrity. Therefore, we recommend that users copy/append only one table at a time, or limit the copy/append to a very small number of tables.

Using copy with partitioned replication

When tables in a configuration use partitioned replication:

  • The copy/append command will support the copying of individual tables and individual partitioned tables.
  • Specifying a partition as a target but not a source is not supported.
  • The copy/append command does not support vertically or horizontally partitioned tables currently in replication.

Controlling the number of processing threads

To take advantage of machines with multiple processors, you can set the number of copy/append processing threads on the source system using the SP_XSY_SVR_THREADS parameter. The default value of this parameter is set to two (2) threads, and the range of valid values is from 1 to 32 threads.

You can also set the number of copy/append processing threads on the target system using the SP_XSY_CLT_THREADS parameter. The default value of this parameter is set to two (2) threads, and the range of valid values is from 1 to 32 threads.

Using wildcards in command line syntax

Wildcards may be employed when specifying the source_table portion of the copy/append command. Additionally, you may use not notation to exclude specific objects.

You may specify all the tables in a specific schema using the following:

sp_ctrl (irvspxu14:8567)> copy scott.%

In the above example, all objects under the scott schema will be copied, provided the objects are currently in replication.

You can also set exclusions using the following:

sp_ctrl (irvspxu14:8567)> copy scott.% not (%"foo"%)

In the above example, all objects under the scott schema, except objects whose name contain “foo”, will be copied, provided the objects are currently in replication.

For more information about how SharePlex supports wildcards, see the SharePlex Administration Guide.

Other considerations for using copy/append

  • When using the copy/append command to sync a table that is out-of-sync or when using the copy/append command to place a table into replication while instantiating it the Post process will pause for tables being copied/appended while the table is being copied. The Post process will resume for tables being copied/appended when the copy/append command is complete. This does not apply to a table that is being added to replication through a new route.
  • The copy/append command can operate on multiple tables based on the value of the SP_XSY_PROCESSES parameter.
  • When using the copy/append command for a table not in a known replication route the user must employ the force option. To employ copy/append on objects not in replication the user must employ the force option.
  • When using the copy/append command for a table in replication, all SharePlex processes (Capture, Read, Export, Import, Post) must be running when you issue the copy/append command, and they must remain running throughout the processes.
  • Do not use the copy/append command in a cascading replication environment.
  • Tables with foreign keys should have those keys disabled and then re-enabled.
  • When objects are in replication, the copy/append command briefly locks the source table, while the target table is not locked. The source tables can undergo changes while they are being copied or appended; however, it is assumed that the target table will not undergo any changes by any process or application other than SharePlex.

  • The copy/append command will only be able to copy or append data between two objects on the same database if the objects reside in different schemas.
  • Activating a new config while the copy/append process is running may cause the synchronization process to fail.

Note: The syntax for the copy and append commands are exactly the same. The examples that appear below utilize the copy command, but the append command can be invoked by simply substituting append for copy.

Usage

Supported sources: Oracle
Supported targets: PostgreSQL
Authorization level: Operator (2)
Issues on: source system
Related commands: None

Syntax

Basic command Command options Remote options

{copy | append} source_schema.source_table.[partition]

 

[not (list of exceptions)]

[totarget_schema.target_table[.partition]]

[at target_host[@target_SID]

[for o.source_SID]

[force]

[status]

[ on host |

on host:portnumber |

on login/password@host |

on login/password@host:portnumber ]

{copy | append} using filename

[for o.source_SID]

[force]

[ on host |

on host:portnumber |

on login/password@host |

on login/password@host:portnumber ]

Syntax description
Component Description

source_schema.source_table

Specifies an individual source schema and source table name or a group of objects using wildcards. Not valid if using {copy | append} with the usingfilename syntax.

When used without the totarget_schema.target_table option, this syntax assumes that the synchronization target is the same as the replication target.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl

sp_ctrl(sysA)>append s_user1.sync_single_tbl

filename

The name of a synchronization routing file containing the tables to be synchronized. File names are case-sensitive.

Use this option when using the {copy | append} using command.

Example:

sp_ctrl(SysA)>copy using sync_file_2.txt

sp_ctrl(sysA)>append using sync_file_2.txt

[not (list of exceptions)]

Specifies an exception list of tables not to be copied/appended when the table specification includes wildcards.

The exception_list is a list of table names that should not be copied/appended.

Consider three tables: copytest1, copytest2, and copytest3. In the example below, only the data from the copytest3 table is copied to the target.

sp_ctrl > copy s_user1.% not (copytest1,copytest2)

totarget_schema.target_table [.partition]

Specifies the target table for synchronization. This option only valid with the source_schema.source_table option.

If the table is not in replication, use this option in conjunction with the attarget_host@ [target_dbid] option.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl to d_user1.sync_single_tbl

sp_ctrl(SysA)>append s_user1.sync_single_tbl to d_user1.sync_single_tbl

at target_host@ [target_DBID]

Specifies the location of the target table for synchronization. Use in conjunction with the totarget_schema.target_table [.partition] option.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl to d_user1.sync_single_tbl at d_host1@r.d_sid1

sp_ctrl(SysA)>append s_user1.sync_single_tbl to d_user1.sync_single_tbl at d_host1@r.d_sid1

for o.source_SID

Use to specify the datasource that contains the objects to be synchronized, if there is no active configuration, or if there are more than one active configurations.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl for o.source_sid at target_host@o.target_sid force

sp_ctrl(SysA)>append s_user1.sync_single_tbl for o.source_sid at target_host@o.target_sid force

force

Use this option when tables intended for synchronization are not in replication or when the table route does not match an existing or known route.

Examples:

sp_ctrl(SysA)>copy s_user1.sync_single_tbl at target_host@r.target_sid force

sp_ctrl(SysA)>append s_user1.sync_single_tbl at target_host@r.target_sid force

status

Displays status history for previous copy/append commands.

sp_ctrl(SysA)>copy status

sp_ctrl(SysA)>append status

Remote options

These options enable you to issue the command on a remote machine and to script commands that include a login name, password, port number, or combination of those items.

Option Description
on host

Execute the command on a remote system (one other than the one where the current sp_ctrl session is running). You are prompted for login credentials for the remote system. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on SysA

on host:portnumber

Execute the command on a remote system when a remote login and port number must be provided. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on SysA:8304

on login/password@host

Execute the command on a remote system when a remote login, password, and host name must be provided. If used, must be the last component of the command syntax.

Example:sp_ctrl(sysB)>status on john/spot5489@SysA

on login/password@host:portnumber

Execute the command on a remote system when a remote login, password, host name, and port number must be provided. If used, must be the last component of the command syntax.

Example: sp_ctrl(sysB)>status on john/spot5489@SysA:8304

Verwandte Dokumente

The document was helpful.

Bewertung auswählen

I easily found the information I needed.

Bewertung auswählen