cdr sync replicate

The cdr sync replicate command synchronizes data among replication servers to repair inconsistent data within a replicate.

Syntax


1  cdr sync replicate?  %Connect Option  (1)  --master=data_server  --repl=repl_name
1 +  target_server
1  --all
2?  --name=task_name
2?   --extratargetrows=
3.1! delete
3.1 keep
3.1 merge
2?   --firetrigger=
3.1! off
3.1 on
3.1 follow
2?  --memadjust=size
3.1 K
3.1 M
2?   --background
2?   --excludeTimeSeries
2?   --ignoreHiddenTSElements
Notes:
Element Purpose Restrictions Syntax
data_server Name of the database server to use as the reference copy of the data. Must be the name of an existing database server group in SQLHOSTS. Long Identifiers
repl_name Name of the replicate to synchronize. Long Identifiers
sizeK or sizeM Size, in either kilobytes (K) or megabytes (M), of the send queue during synchronization. Must be a positive integer and must not be greater than the amount of available memory.
target_server Name of a database server group on which to perform synchronization. Must be the name of an existing database server group in SQLHOSTS. Long Identifiers

The following table describes the cdr sync replicate options.

Long Form Short Form Meaning
--master= -m Specifies the database server to use as the reference copy of the data.
--memadjust= -J Increases the size of the send queue during synchronization to the number of kilobytes or megabytes specified by the size element.
--repl= -r Specifies the name of the replicate to synchronize.

Usage

Use the cdr sync replicate command to synchronize data between multiple database servers for a specific replicate. This command performs direct synchronization as a foreground process.

The size of the send queue is specified by the value of the CDR_QUEUEMEM configuration parameter. You can increase the amount of memory that the send queue can use during this synchronization operation by using the --memadjust option to specify the size of the send queue.

If you want to monitor the progress of the synchronization operation, include the --name option and specify a name for the progress report task. Then run the cdr stats sync command and specify the progress report task name.

You can run a synchronization operation as a background operation as an SQL administration API command if you include the --background option. This option is useful if you want to schedule regular synchronization operations with the Scheduler. If you run a synchronization operation in the background, you should provide a name for the progress report task by using the --name option so that you can monitor the operation with the cdr stats sync command. You can also view the command and its results in the command_history table in the sysadmin database.

The cdr sync replicate command performs the following tasks:

  1. Creates a shadow replicate with the source server and target server as participants. The conflict resolution rule for the shadow replicate is always apply.
  2. Performs a sequential scan of the replicated table on the source server.
  3. Replicates the all rows in the table from the source server to the target server by copying the data directly into the send queue, bypassing the logical logs.
  4. Deletes the shadow replicate.

You can run this command from within an SQL statement by using the SQL administration API.

Return codes

A return code of 0 indicates that the command was successful.

If the command is not successful, one of the following error codes is returned: 1, 5, 17, 18, 31, 37, 48, 53, 61, 75, 99, 101, 121, 172, 174, 178, 193, 194, 195, 200, 203, 204.

For information on these error codes, see Return Codes for the cdr Utility

Example 1: Synchronize all servers

The following example illustrates synchronizing all replication servers for the replicate named repl_1:
cdr sync replicate --master=g_serv1 --repl=repl_1\
--all --extratargetrows=keep\
--firetrigger=on
The data on the server group g_serv1 is used as the reference for correcting the data on the other servers. Line 2 indicates that all servers associated with the replicate are synchronized and that if the synchronization operation detects rows on the target servers that do not exist on the reference server (g_serv1), that those rows should remain on the other servers. Line 3 indicates that triggers should be fired on the target servers even if the replicate definition does not include the --firetrigger option.

Example 2: Synchronize three servers

The following example illustrates synchronizing three servers for the replicate named repl_2:
cdr sync replicate -m g_serv1 -r repl_2\
g_serv2 g_serv3
The reference server is g_serv1 and the target servers are g_serv2 and g_serv3. Because the --extratargetrows option is not specified, the default behavior occurs: rows, and any dependent rows that are based on referential integrity constraints, that are on the target servers but not on the reference server, are deleted.

Example 3: Synchronize in the background and set the send queue size

The following example illustrates synchronizing in the background and setting the size of the send queue to 50 MB:

cdr sync replicate --master=g_serv1 --repl=repl_1\
--memadjust=50M --background