IBM Books

DB2 Replication Guide and Reference


Operating Capture for AIX, Capture for HP-UX, Capture for Solaris, and Capture for UnixWare 7

The administrator user ID can use the commands in this section to operate Capture for UNIX platforms. Enter the commands or key combinations from an AIX, HP-UX, Solaris, or UnixWare 7 window.

This section explains how to perform the following Capture tasks:

Before You Start the Capture Program

Before starting the Capture program, make sure you complete the following post-installation tasks:

Starting Capture for AIX, Capture for HP-UX, Capture for Solaris, and Capture for UnixWare 7

After you start Capture, it runs continuously until you stop it or it detects an error.

To start Capture for AIX, Capture for HP-UX, Capture for Solaris, and Capture for UnixWare 7:

  1. From AIX, HP-UX, Solaris, or UnixWare 7, log in and make sure that the user ID under which Capture is running has write privilege on the directory.

  2. Ensure that you set the DB2 instance as shown:
    export DB2INSTANCE=db2_instance_name
    

    While the Capture program is running, a file with the name <database_instance_name><database_name>.CCP is created in the directory from which the Capture program is invoked. This file is a log file for the messages issued by the Capture program; these messages are also recorded in the ASN.IBMSNAP_TRACE table.

  3. Set the LIBPATH environment variable in the same environment in which the Capture program starts.

    AIX example:

    export LIBPATH=~/sqllib/lib:/usr/lib:/lib
    

    HP-UX example:

    export SHLIB_PATH=~/sqllib/lib:/usr/lib:/lib
    

    Solaris and UnixWare 7 example:

    export LD_LIBRARY_PATH=~/sqllib/lib:/usr/lib:/lib
    export NLS_PATH=~/usr/lib/locale/%L/%N:/usr/lib/ locale/prime/%N
    

  4. Enter the following command:
>>-asnccp--+------------+---+--------+---+---------+---+---------+->
           '-src_server-'   +-warm---+   +-prune---+   +-notrace-+
                            +-warmns-+   '-noprune-'   '-trace---'
                            '-cold---'
 
>--------------------------------------------------------------><
 

Table 15 defines the optional parameters.


Table 15. ASNCCP Command Parameter Definitions for UNIX Platforms

Parameter
Definition

src_server
Source server name positional parameter that must be the first parameter if entered. If not specified, the value from the DB2DBDFT environment variable will be used.

warm  (default) 
The Capture program resumes processing where it ended in its previous run if warm start information is available. If the Capture program cannot warm start, it switches to a cold start. See Warm and Cold Starts for more information.

warmns
The Capture program resumes processing where it ended in its previous run if warm start information is available. Otherwise, it issues a message and terminates. With warmns, the Capture program does not automatically switch to a cold start. The Capture program leaves the trace, UOW, CD, and warm start tables intact. In case of errors, Capture terminates instead of switching to a cold start as when warm is specified. See Warm and Cold Starts for more information.

cold
The Capture program starts by deleting all rows in its CD table, UOW table, and trace table during initialization. Refer to Warm and Cold Starts for more information.

prune  (default) 
The Capture program automatically prunes the CD tables and the UOW table.

noprune
Automatic pruning is disabled. The Capture program prunes the CD tables and the UOW table when you enter the prune command. See the PRUNE command for more information.

notrace  (default) 
No trace information is written.

trace
Writes debug trace messages to the standard output, stdout.

Scheduling Capture for AIX, Capture for HP-UX, Capture for Solaris, and Capture for UnixWare 7

Use the at command to start Capture at a specific time. For example, the following command starts Capture at 3:00 p.m. on Friday:

at 3pm Friday asnccp warmns noprune

Stopping Capture for AIX, Capture for HP-UX, Capture for Solaris, and Capture for UnixWare 7

>>-asncmd--stop------------------------------------------------><
 

or

>>-kill---INT--pid---------------------------------------------><
 

or one of the following:

Purpose

Use the stop command, the kill command, or the key combinations to stop the Capture program in an orderly way and commit the log records that it processed up to that point.

Stop Capture before:

Usage

Stopping the Capture Program with a Trigger

In some situations, you might want to trigger the stop of the Capture program. For example, you might want to stop it at a specific time, or after all transactions for a particular application have been committed. The simplest way to set up this trigger is to create a table (or use an existing table), define it as a replication source, and identify a particular column whose update, when captured, triggers shutdown.

To stop the Capture program with a trigger:

Use the following example as a guideline.

  1. Create a table with a column named STOPCAP or another unique identifier.

  2. Define the table as a replication source.

  3. Create an application that periodically reads the CD table associated with this replication source table to search for STOPCAP.

  4. Schedule the application to start before your Apply programs.

When your application encounters STOPCAP in the CD table, it should issue the command to stop the Capture program.

Suspending Capture for AIX, Capture for HP-UX, Capture for Solaris, and Capture for UnixWare 7

>>-asncmd--suspend---------------------------------------------><
 

Purpose

Use the suspend command to relinquish AIX, HP-UX, Solaris, or UnixWare 7 resources to operational transactions during peak periods without destroying the Capture program environment.

This command suspends the Capture program until you issue the resume command.

Attention:

Do not use the suspend command when canceling a replication source. Instead, stop the Capture program.

Usage

To use the command, do the following from a different window than where the Capture program is running:

  1. Set environment variable DB2INSTANCE to the value set when the Capture program was started.

  2. Set environment variable DB2DBDFT to the source server specified when the Capture program was started (or the DB2DBDFT value used when the Capture program was started).

  3. Enter the command.

Resuming Capture for AIX, Capture for HP-UX, Capture for Solaris, and Capture for UnixWare 7

>>-asncmd--resume----------------------------------------------><
 

Purpose

Use the resume command to restart the Capture program if you suspended it using the suspend command.

Usage

To use the command, do the following from a different window than where the Capture program is running:

  1. Set environment variable DB2INSTANCE to the value set when the Capture program was started.

  2. Set environment variable DB2DBDFT to the source server specified when the Capture program was started (or the DB2DBDFT value used when the Capture program was started).

  3. Enter the command.

Reinitializing Capture for AIX, Capture for HP-UX, Capture for Solaris, and Capture for UnixWare 7

>>-asncmd--reinit----------------------------------------------><
 

Purpose

Use the reinit command to have the Capture program reread the ASN.IBMSNAP_REGISTER tables or the ASN.IBMSNAP_CCPPARMS table while it is running. Use this command when you add a new replication source with Control Center or when the values in the ASN.IBMSNAP_CCPPARMS table are changed while the Capture program is running.

This command ensures that the Capture program recognizes the new replication source. The Capture program also rereads the ASN.IBMSNAP_CCPPARMS table for any changes made to the tuning parameters.

Attention:

Do not use the reinit command to reinitialize the Capture program after canceling a replication source or dropping a replication source table while Capture is running. Instead, stop the Capture program and restart it using the WARM or WARMNS option.

Usage

To use the command, do the following from a different window than where the Capture program is running:

  1. Set environment variable DB2INSTANCE to the value set when the Capture program was started.

  2. Set environment variable DB2DBDFT to the source server specified when the Capture program was started (or the DB2DBDFT value used when the Capture program was started).

  3. Enter the command.

Pruning the Change Data and Unit-of-Work Tables

>>-asncmd--prune-----------------------------------------------><
 

Purpose

Use the prune command to perform pruning of the change data (CD) table and unit-of-work (UOW) table if you disabled pruning by using the noprune invocation parameter while starting the Capture program.

This command prunes the CD and UOW tables once. The Capture program issues the message ASN0124I when the command is successfully queued.

Usage

To use the command, do the following from a different window than where the Capture program is running:

  1. Set environment variable DB2INSTANCE to the value set when the Capture program was started.

  2. Set environment variable DB2DBDFT to the source server specified when the Capture program was started (or the DB2DBDFT value used when the Capture program was started).

  3. Enter the command.

During pruning, if you stop or suspend Capture, pruning does not resume after you enter the resume command. You must enter the prune command again to resume pruning.

Providing the Current Log Sequence Number

>>-asncmd--getlseq---------------------------------------------><
 

Purpose

Use the getlseq command to provide the timestamp and current log sequence number. You can use this number to determine how far Capture has read the DB2 log.

Usage

To use the command, do the following from a different window than where the Capture program is running:

  1. Set environment variable DB2INSTANCE to the value set when the Capture program was started.

  2. Set environment variable DB2DBDFT to the source server specified when the Capture program was started (or the DB2DBDFT value used when the Capture program was started).

  3. Enter the command.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]