SQL and Apply program error messages can be found in the Apply trail table and the Apply program trace file. There is one trace file at the server associated with the Apply program. The Apply program log file tracks the activities of the Apply program and can be a useful diagnosis tool.
There is an Apply trail table (ASN.IBMSNAP_APPLYTRAIL) located at each control server with the subscription control tables, such as ASN.IBMSNAP_SUBS_SET. The Apply program inserts a new row in the Apply trail table every time it attempts to replicate a subscription. There is a row for all successful and unsuccessful subscription cycles of each replication subscription. For a description of the ASN.IBMSNAP_APPLYTRAIL table, see Table structures.
The Apply trail table records one SQL code and one SQL state for a replication subscription that does not get replicated successfully. Additional SQL codes and states associated with the problem can be found in the Apply program trace file.
You can query the Apply trail table for information about successful and unsuccessful replications. Some key fields in the table that have problem indicators are:
Within the error message text, determine which database the Apply program was connected to when the error occurred; for example, did the error occur while the Apply program was connected to the source server or the copy server?
The Apply trail table has fields that identify the source and target databases and tables so that you can locate the Apply trail control rows that are causing replication errors. To reduce the number of rows that you examine, you can:
An example query for the ASN.IBMSNAP_APPLYTRAIL is:
SELECT * FROM ASN.IBMSNAP_APPLYTRAIL SELECT TARGET_TABLE, STATUS, SQLSTATE, SQLCODE, SQLERRM, APPERRM FROM ASN.IBMSNAP_APPLYTRAIL
The Apply program creates a trace file when the Apply program trace invocation parameter is used. See the Capture and Apply chapter for your platform in this book for the Apply program invocation command.
If you specify a trace option, specify the name of a trace output file and, for workstation systems, precede the output file name with a pipe symbol (>). For example, to start Apply for Windows with trace, issue the following command from the command line processor window:
\APPLY>asnapply myapply mydbnt2 trcflow > apply.trc
Where:
The trace file is located in the same directory from which the Apply program is started.
After the Apply program is stopped, you can view the trace file with any editor. You can also transmit the file to other systems, such as by FTP, or print it.
You have two trace options:
Within the trace, particularly with the TRCFLOW option, entries are made into the trace file for the Apply program's activities. The following are examples of the recorded information:
The Apply program inserts error messages and indicators in the trace file at points when it encounters an error.
The Apply program also has a log file containing messages with a summary of the Apply program's activities. The log file is in the same directory from which the Apply program is started and where the *.SPL file and any trace files are located.
The name of the Apply program log file is the Apply qualifier associated with the control server with the extension of *.APP. For example, for an Apply program operating with Apply qualifier MYAPPLY, the log file name is MYAPPLY.APP.
Because the Apply program log file information is high level, it typically directs you to the ASN.IBMSNAP_APPLYTRAIL table for more detailed information.