Home | Previous Page | Next Page   Appendix A. Command-Line Utility Reference > 4 4 4

cdr check replicate

4
The cdr check replicate command compares the 4data on replication servers to create a report listing data inconsistencies 4and can optionally repair the inconsistent data within a replicate. 4
4

Syntax

4
4
Read syntax diagramSkip visual syntax diagram4>>-cdr check replicate--+-------------------------+------------->
4                        |                    (1)  |
4                        '-| Connect Option |------'
4 
4>-- --master=data_server-- --repl=repl_name--------------------->
4 
4     .---------------.
4     V               |
4>--+---target_server-+-+--+------------+------------------------>
4   '- --all------------'  '- --verbose-'
4 
4>--+------------------------------------------------+----------><
4   '- --repair--+---------------------------------+-'
4                '- --extratargetrows=--+-delete-+-'
4                                       +-keep---+
4                                       '-merge--'
4 
4 4 4
Notes:
4
    4
  1. See page Connect Option.
  2. 4
4 444444444444444444444444444444
Element Purpose Restrictions Syntax
data_server Name of the database server to use as the reference copy 4of the data Must be the name of an existing database server group in 4SQLHOSTS. See Setting up Database Server 4Groups. Long Identifiers
repl_name Name of the replicate to check Long Identifiers
target_server Name of a database server group to check Must be the name of an existing database server group in 4SQLHOSTS. See Setting up Database Server 4Groups. Long Identifiers
4

The following table describes the cdr check replicate options.

4 44444444444444444444444444444444444444444
Long Form Short Form Meaning
--all -a Specifies that all servers defined for the replicate are 4checked
--extratargetrows= -e Specifies how to handle rows found on the target servers 4that are not present on the server from which the data is being copied (data_server): 4
    4
  • delete: (default) remove rows and dependent rows, 4based on referential integrity constraints, from the target servers
  • 4
  • keep: retain rows on the target servers
  • 4
  • merge: retain rows on the target servers and replicate 4them to the data source server
--master= -m Specifies the database server to use as the reference copy 4of the data
--repair -R Specifies that rows that are found to be inconsistent are 4repaired
--repl= -r Specifies the name of the replicate to check
--verbose -v Specifies that the consistency report shows specific inconsistent 4rows, identified by their primary key values
4
4

Usage

4
4

Use the cdr check replicate command to check the 4consistency of data between multiple database servers for a specific replicate. 4The cdr check replicate command compares all rows on 4all specified database servers against the data in the reference server and 4produces a consistency report. If you include the --verbose option, the report lists every inconsistent row; otherwise, the report 4summarizes inconsistent rows. If you include the --repair option, the cdr check replicate command repairs 4inconsistent rows so that they match the rows on the reference server. During 4a repair of inconsistent rows, the cdr check replicate command 4uses direct synchronization as a foreground process.

4

The cdr check replicate command requires that its 4associated user-defined routines are installed and registered in each 4database that is involved in the checking process. For instructions about 4installing and registering these routines, see Preparing the checksum 4Support Functions.

4
4

Examples

4
4

The following command generates a consistency report for a replicate named repl1, comparing the data on the server serv2 with the data on the server serv1:

4
cdr check replicate --master g_serv1 --repl=repl_1 g_serv2
4

The summary consistency report for the previous command might be:

4
------   Statistics for repl1 ------
4Node                  Rows     Extra   Missing  Mismatch Processed
4---------------- --------- --------- --------- --------- ---------
4g_serv1                 52         0         0         0         0
4g_serv2                 52         0         0         0         0
4

This report indicates that the replicate is consistent on these servers.

4

If the replicate has inconsistencies, the consistency report for the previous 4command might be:

4
------   Statistics for repl1 ------
4Node                  Rows     Extra   Missing  Mismatch Processed
4---------------- --------- --------- --------- --------- ---------
4g_serv1                 67         0         0         0         0
4g_serv2                 65         0         2         1         0
4
4WARNING: replicate is not in sync

This report indicates that the server g_serv2 is 4missing two rows and has one inconsistent row.

4

The following command generates a consistency report and repairs inconsistent 4rows on all servers for a replicate named repl1:

4
cdr check replicate --master g_serv1 --repl=repl_1 --all --repair
4

The consistency report for the previous command might be:

4
------   Statistics for repl1 ------
4Node                  Rows     Extra   Missing  Mismatch Processed
4---------------- --------- --------- --------- --------- ---------
4g_serv1                 67         0         0         0         3
4g_serv2                 65         0         2         1         0
4g_serv3                 67         0         0         0         0
4
4WARNING: replicate is not in sync

This report indicates that three rows were replicated from g_serv1 to g_serv2: two missing rows plus one inconsistent 4row.

4

If a target server has extra rows, the consistency report for the previous 4command might be:

4
------   Statistics for repl1 ------
4Node                  Rows     Extra   Missing  Mismatch Processed
4---------------- --------- --------- --------- --------- ---------
4g_serv1                 67         0         0         0         2
4g_serv2                 67         2         2         0         2
4g_serv3                 67         0         0         0         0
4
4WARNING: replicate is not in sync

This report indicates that g_serv2 has two extra 4rows and is missing two rows. Two rows were processed on g_serv1 to replicate the missing rows to g_serv2. 4Also, two rows were processed on g_serv2 to delete the 4extra rows. Because the --extratargetrows option is 4not specified, the default behavior of deleting rows on the target servers 4that are not on the reference server occurs.

4

The following table describes the columns of the consistency report.

4 44444444444444444444444444444444444
Table 29. Consistency Report Description
Column name Description
Node The name of the replication server
Rows The number of rows in the participant
Extra The number of rows on the target server that do not 4exist on the reference server 4

For the reference server, this number is always 40.

Missing The number of rows on the reference server that do not 4exist on the target server 4

For the reference server, this number is always 40.

Mismatch The number of rows on the target server that are not 4consistent with the corresponding rows on the reference server 4

For the reference 4server, this number is always 0.

Processed The number of rows processed to correct inconsistent 4rows 4

The number of processed rows on the reference server is equal to the 4number of mismatched rows plus missing rows on the target servers.

4

The number of processed rows for a target server is usually equal to the number 4of extra rows it has. If a row has child rows, then the number of processed 4rows can be greater than the number of extra rows because the child rows must 4be deleted as well. If the --extratargetrows option 4is set to keep, then extra rows are not deleted from 4the target and those rows are not added to the Processed column. If the --extratargetrows option is set to merge, then those rows are replicated to the reference server and are listed 4in the Processed column for the target server.

4

The following command generates a verbose consistency report for a replicate 4named repl1:

4
cdr check replicate --master g_serv1 --repl=repl_1 g_serv2 --all --verbose
4

The verbose consistency report for the previous command might be:

4
------   Statistics for repl1 ------
4data mismatch between g_serv1 and g_serv2
4item_num:1
4order_num:1011
4--------------------------------------------------
4row missing on g_serv2
4item_num:1
4order_num:1014
4--------------------------------------------------
4row missing on g_serv2
4item_num:2
4order_num:1014
4--------------------------------------------------
4Node                  Rows     Extra   Missing  Mismatch Processed
4---------------- --------- --------- --------- --------- ---------
4g_serv1                 67         0         0         0         0
4g_serv2                 65         0         2         1         0
4
4WARNING: replicate is not in sync

This report indicates that there is one inconsistent row on g_serv2. The primary key for that row is the combination of the item_num column and the order_num column. The row 4that is inconsistent is the one that has the item number 1 and 4the order number 1011. There are two rows that are missing on g_serv2, each identified by its primary key values.

4
4

See Also

4
4 4
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]