Use the rs_subcmp standalone executable program to compare a replicate table to the primary version of the table, find—and correct if you so choose—missing, orphaned, and inconsistent rows in Sybase databases.
On UNIX systems, the program is called rs_subcmp. On PC systems, the program is called subcmp. The rs_subcmp program is located in the bin subdirectory of the Sybase release directory. Refer to the Replication Server installation and configuration guides for your platform for more information.
The program works by logging in to the primary data server and the replicate data server, and selecting and comparing rows from both tables.
Because some differences between primary and replicate data can be attributed to latency, rs_subcmp first identifies inconsistencies, and then performs iterations a specified number of times. rs_subcmp waits for any updates to be replicated before removing the corrected rows from its list.
It is best to use rs_subcmp when latency is low to avoid the program having to perform several iterations through the data.
You can instruct rs_subcmp to display inconsistent rows on the standard output, correct them, or both display and correct them.
PDS=TOKYO_DS RDS=SYDNEY_DS PDB=pubs2 RDB=pubs2 RTABLE=sales RSELECT=select * from sales \ order by stor_id, ord_num RUSER=sa KEY=stor_id KEY=ord_num RECONCILE=Y RECONCILE_CHECK=Y WAIT=15 NUM_TRIES=5 VISUAL=Y
The PTABLE, PSELECT, and PUSER parameters, which are used for the primary database, are not shown in this example. Their values are the same as those of corresponding parameters in the replicate databases, so they need not be included in the configuration file.
RSELECT=select * from sales \ order by stor_id, ord_num
rs_subcmp -f sales_cmp -S TOKYO_DS2 > sales_badrows
In this example, the -f option specifies a configuration file name, sales_cmp. If the VISUAL parameter is set to “Y” in the configuration file (equivalent to the -V command line option), a list of the inconsistent rows is generated. In this example, the output is redirected to a file.