cdr sync replicateset

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

Syntax


1  cdr sync replicateset?  %Connect Option  (1)  --master=data_server
1  --replset=repl_set
1  --allrepl
1 +  target_server
1  --all
3?  --name=task_name
3?   --extratargetrows= 
4.1! delete
4.1 keep
4.1 merge
3?   --firetrigger= 
4.1! off
4.1 on
4.1 follow
3?  --memadjust= size
4.1 K
4.1 M
3?   --background
3?  --process=number_processes
3?   --excludeTimeSeries
3?   --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
number_processes The number of parallel processes to use for the command. The maximum number of processes Enterprise Replication can use is equal to the number of replicates in the replicate set.
repl_set Name of the replicate set. Can be the name of a derived replicate set. Long Identifiers
seconds The number of seconds to wait for a disabled replication server to be recognized as active by other replication servers in the domain and how long to wait for control messages queued at peer servers to be applied at newly-enabled server. Must be an integer value from 0 to 60.
target_server Name of a database server group to check. Must be the name of an existing database server group in SQLHOSTS. Long Identifiers
task_name The name of the progress report task. If you use an existing task name, the information for that task is overwritten.

Maximum name length is 127 bytes.

Long Identifiers

The following table describes the cdr sync replicateset options.

Long Form Short Form Meaning
--all -a Specifies that all servers defined for the replicate are checked.
--allrepl -A Specifies that all replicates are synchronized.
--excludeTimeSeries Specifies to prevent the checking of time series data.
--extratargetrows= -e Specifies how to handle rows that are found on the target servers that are not present on the server from which the data is being copied (data_server):
  • delete: (default) remove rows and dependent rows, based on referential integrity constraints, from the target servers
  • keep: retain rows on the target servers
  • merge: retain rows on the target servers and replicate them to the data source server. You cannot use this option for replicates that include TimeSeries columns.
--firetrigger= -T Specifies how to handle triggers at the target servers while data is synchronizing:
  • off: (default) do not fire triggers at target servers during synchronization
  • on: always fire triggers at the target servers even if the replicate definition does not have the --firetrigger option
  • follow: fire triggers at target servers only if the replicate definition has the --firetrigger option
--ignoreHiddenTSElements Specifies to avoid checking time series elements that are marked as hidden.
--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.
--name= -n Specifies that the progress of this command can be monitored. Information about the operation is stored under the specified progress report task name on the server on which the command was run.
--process= -p Specifies to run the command in parallel, using the specified number of processes. At most, Enterprise Replication can use one process for each replicate in the replicate set. If you specify more processes than replicates, the extra processes are not used.

Not all replicates can be processed in parallel. For example, if replicates have referential integrity rules, the replicates with the parent tables must be processed before the replicates with the child tables.

--replset -s Specifies the name of the replicate set to synchronize.

Usage

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

If you run this command as a DBSA instead of as user informix, you must have INSERT, UPDATE, and DELETE permission on the replicated tables on all the replication servers in the domain.

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.

You can significantly improve the performance of synchronizing a replicate set by synchronizing the member replicates in parallel. You specify the number of parallel processes with the --process option. For best performance, specify the same number of processes as the number of replicates in the replicate set. However, replicates with referential integrity constraints cannot be processed in parallel.

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.

To synchronize all replicates at once, use the --allrepl option.

The cdr sync replicateset command performs the following tasks:

  1. Determines the order in which to repair tables if they have referential relationships.
  2. Creates a shadow replicate with the source server and target server as participants. The conflict resolution rule for the shadow replicate is always apply.
  3. Performs a sequential scan of the replicated table on the source server.
  4. 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. Rows are not replicated to participants that include the S option in the participant definition because those participants only send data.
  5. Deletes the shadow replicate.
  6. Repeats steps 2 through 5 for each replicate in the replicate set.

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, 11, 17, 18, 31, 37, 48, 53, 61, 75, 99, 101, 121, 166, 172, 174, 193, 194, 195, 200, 203, 204, 213.

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 set replset_1 using g_serv1 as the reference server:
cdr sync replicateset --master=g_serv1 --replset=replset_1\
--all --extratargetrows=keep
Line 2 indicates that all servers associated with the replicate set are synchronized and that if the synchronization process 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.

Example 2: Synchronize three servers in parallel

The following example illustrates synchronizing three servers for the replicate set named replset_2 and using two processes to synchronize each of the two replicates in the set in parallel:
cdr sync replicateset -m g_serv1 -s replset_2\
g_serv2 g_serv3 --process=2
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 replicateset --master=g_serv1 --replset=replset_1\
--memadjust=50M --background

Example 4: Synchronize all replicate sets on a replication server

The following command synchronizes all replicate sets on a replication server named g_serv2:

cdr sync replicateset --allrepl g_serv2

The replicate set name is not specified because the --allrepl option is used.