cdr sync replicate

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

Syntax

Read syntax diagramSkip visual syntax diagram
>>-cdr sync replicate--+--------------------------+------------->
                       |                      (1) |   
                       '-| Connect Option   |-----'   

>-- --master=data_server-- --repl=repl_name--------------------->

     .---------------.                            
     V               |                            
>--+---target_server-+-+--+-------------------+----------------->
   '- --all------------'  '- --name=task_name-'   

>--+---------------------------------+-------------------------->
   |                      .-delete-. |   
   '- --extratargetrows=--+-keep---+-'   
                          '-merge--'     

>--+-----------------------------+------------------------------>
   |                  .-off----. |   
   '- --firetrigger=--+-on-----+-'   
                      '-follow-'     

>--+-------------------------+--+---------------+--------------->
   '- --memadjust=size-+-K-+-'  '- --background-'   
                       '-M-'                        

>--+----------------------+--+---------------------------+-----><
   '- --excludeTimeSeries-'  '- --ignoreHiddenTSElements-'   

Notes:
  1. See Connect Option.
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
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 replicate options.

Long Form Short Form Meaning
--all -a Specifies that all servers defined for the replicate are checked.
--background -B Specifies that the operation is run in the background as an SQL administration API command.

The command and its result are stored in the command_history table in the sysadmin database, under the name that is specified by the --name= option, or the time stamp for the command if --name= is not specified.

--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.
--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.

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.

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. Rows are not replicated to participants that include the S option in the participant definition because those participants only send data.
  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

Copyright© 2018 HCL Technologies Limited