Use the asntrep command to synchronize a source and target table by repairing differences between the two tables. Run the asntrep command on Linux, UNIX, and Windows at an operating system prompt or in a shell script.
>>-asntrep--DB=server--+---------------+------------------------> '-SCHEMA=schema-' >--+-------------------------------------+----------------------> '-DIFF_SCHEMA=difference_table_schema-' >--+----------------------------+--WHERE=WHERE_clause-----------> '-DIFF_TABLESPACE=tablespace-' >--+--------------------+--+------------------+-----------------> '-DIFF_PATH=log_path-' '-PWDFILE=filename-' >--+-----------------+--+------------------+--------------------> '-DIFF=table_name-' | .-y-. | '-DIFF_DROP=-+-n-+-' >--+------------------------+---------------------------------->< '-SQLID=authorization_ID-'
Table 1 defines the invocation parameters for the asntrep command.
Parameter | Definition |
---|---|
DB=server | Specifies the DB2® alias
of the database that stores information about the source and target
tables that you want to synchronize. The value differs depending on
whether you are using Q Replication or SQL Replication:
When the DB parameter refers to a DB2 for z/OS® subsystem, the value is the alias name that was used to catalog the subsystem on the Linux, UNIX, or Windows system where asntrep is running. |
SCHEMA=schema | Specifies the schema of the Q Capture control tables for Q Replication, or the Apply control tables for SQL Replication. |
DIFF_SCHEMA= |
Specifies the schema that qualifies the difference table. The default is ASN. |
DIFF_TABLESPACE=tablespace | Specifies the table space where a copy of the difference table is placed in the target database or subsystem. The copy is then used to repair the target table. If this parameter is not specified, the table will be created in the default table space in the database or subsystem in which the asntrep command was run. |
WHERE=WHERE_clause | Specifies a SQL WHERE clause that uniquely
identifies one row of the control table that stores information about
the source and target tables that you are synchronizing. The WHERE
clause must be in double quotation marks. The value of this parameter
differs depending on whether you are using Q Replication or SQL Replication:
|
DIFF_PATH=log_path | Specifies the location where you want the asntrep utility to write its log. The default value is the directory where you ran the command. The value must be an absolute path name. Use double quotation marks ("") to preserve case. |
PWDFILE=filename | Specifies the name of the password file that is used to connect to databases. If you do not specify a password file, the default value is asnpwd.aut (the name of the password file that is created by the asnpwd command). The asntrep utility searches for the password file in the directory that is specified by the DIFF_PATH parameter. If no value for the DIFF_PATH parameter is specified, the command searches for the password file in the directory where the command was run. |
DIFF=table_name | Specifies the name of the table that was created in the source database by the asntdiff command to store differences between the source and target tables. The information that is stored in this table is used to synchronize the source and target tables. |
DIFF_DROP=y/n | Specifies whether an existing difference
copy table is dropped and recreated before it is reused to record
differences. If the table does not exist, the asntrep command
creates it.
Note: If the key that is used by replication to detect
conflicts is changed and the difference copy table was created before
the key was changed, the asntrep command must be invoked with the DIFF_DROP=Y
option so that asntrepair can drop and recreate the difference copy
table with the correct replication key.
|
SQLID=authorization_ID | Specifies an authorization ID that can be used to create the difference copy table. Use this parameter if the ID that is used to run the asntrep command does not have authorization to create tables. The value of the SQLID parameter is used as the schema for the difference copy table if you do not explicitly specify a schema by using the DIFF_SCHEMA parameter. |
The following examples illustrate how to use the asntrep command.
Example 1
In Q Replication, to synchronize a source and target table that are specified in a Q subscription named my_qsub, on a Q Capture server named source_db, with a Q Capture schema of asn, and whose differences are stored in a table called q_diff_table:
asntrep db=source_db schema=asn where="subname = 'my_qsub'" diff=q_diff_table
Example 2
In SQL Replication, to synchronize a source and target table that are specified in a subscription set called my_set, with a target table named trg_table, on an Apply control server named apply_db, with an Apply schema of asn, and whose differences are stored in a table called sql_diff_table:
asntrep DB=apply_db SCHEMA=asn WHERE="set_name = 'my_set'
and target_table = 'trg_table'" diff=sql_diff_table