Initially Synchronizing Data Among Database Servers

About this task

Enterprise Replication provides an initial synchronization feature that allows you to easily bring a new table up-to-date with replication when you start a new replicate, or when you add a new participant to an existing replicate.

You do not need to suspend any servers that are replicating data while you add the new replicate and synchronize it.

The cdr start replicate and cdr start replicateset commands provide options to perform an initial synchronization for the replicates you are starting. All of the rows that match the replication criteria will be transferred from the source server to the target servers. If you are starting a replicate set, Enterprise Replication synchronizes tables in an order that preserves referential integrity constraints (for example, child tables are synchronized after parent tables).

Use the --syncdatasource (-S) option of the cdr start replicate or cdr start replicateset command to specify the source server for synchronization. Any existing rows in the specified replicates are deleted from the remote tables and replaced by the data from the node you specify using -S.

The --extratargetrows option of the cdr start replicate or cdr start replicateset commands specifies how to handle rows found on the target servers that are not present on the source server. You can specify to remove rows from the target, keep extra rows on the target, or replicate extra rows from the target to other participants.

If you use the cdr start replicate or cdr start replicateset command to specify a subset of servers on which to start the replicate (or replicate set), that replicate (or replicate set) must already be active on the source server. The source server is the server you specify with the -S option. For example, for the following command, repl1 must already be active on serv1:
cdr start repl repl1 ... -S serv1 serv2 serv3
When you start a replicate (or replicate set) for participants on all servers, the replicate does not need to be active on the source server. So, for the following command, repl1 does not need to be active:
cdr start repl1 ... -S serv1

When Enterprise Replication performs initial data synchronization, it keeps track of discrepancies between the constraints set up on source and target server tables. Rows that fail to be repaired due to these discrepancies are recorded in the ATS and RIS files.

If replication fails for some reason and data becomes inconsistent, there are different ways to correct data mismatches between replicated tables while replication is active. The recommended method is direct synchronization. You can also repair data based on an ATS or RIS file. Both of these methods are described in Resynchronizing Data among Replication Servers.