IBM Books

Replication Guide and Reference


Operating Capture for UNIX platforms

An administrator can use the commands in this section to operate the Capture program for UNIX platforms. Enter the commands or a key combination from an AIX, HP-UX, Solaris, or UnixWare 7 window.

This section explains how to perform the following Capture program tasks:

This section also lists restrictions for running the Capture program.

Restrictions for running the Capture program

Some actions cause the Capture program to terminate while it is running. Stop the Capture program before you take any of the following actions:

The Capture program cannot capture any changes made by DB2 utilities, because the utilities do not log changes they make.

Starting Capture for UNIX platforms

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

To start the Capture program for UNIX:

  1. Log in and make sure that the user ID under which the Capture program is running has write privilege on the directory.

  2. Ensure that you set the DB2 instance name 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 started. This file is a log file for the messages issued by the Capture program; these messages are also recorded in the trace table.

  3. Set the LIBPATH environment variable or edit the .profile file in the same environment in which the Capture program starts.

    AIX example:

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

    HP-UX example:

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

    Solaris and UnixWare 7 example:

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

    where db2instance_home_directory is the name of the DB2 instance's home directory.

  4. Enter the following command:
>>-asnccp----+------------+---+--------+---+---------+---------->
             '-src_server-'   +-warm---+   +-prune---+
                              +-warmns-+   '-noprune-'
                              '-cold---'
 
>-----+---------+---+---------+---+----------+---+----------+--->
      +-notrace-+   '-trcfile-'   '-notrctbl-'   '-autostop-'
      '-trace---'
 
>-----+----------+---+-----------+---+---------+---------------><
      '-logreuse-'   '-logstdout-'   +-allchg--+
                                     '-chgonly-'
 

Table 27 defines the invocation parameters.

Table 27. ASNCCP Command Invocation Parameter Definitions for UNIX Platforms
Parameter Definition
src_server Source server name must be the first parameter if entered. If not specified, the value from the DB2DBDFT environment variable is 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.
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, the Capture program terminates instead of switching to a cold start as when warm is specified.
cold The Capture program starts by deleting all rows in its CD table, UOW table, and trace table during initialization. All subscriptions to these replication sources will be fully refreshed during the next Apply program processing cycle.
prune  (default)  The Capture program automatically prunes the rows in the CD and UOW tables that the Apply program has copied, at the interval specified in the tuning parameters table.
noprune Automatic pruning is disabled. The Capture program prunes the CD and the UOW tables when you enter the prune command.
notrace  (default)  No trace information is written.
trace Writes trace messages to the standard output, stdout, unless trcfile is also specified.
trcfile If both trcfile and trace are specified, the Capture program writes trace output to the trace file (*.trc). If you do not specify this option, the Capture program sends trace output to the standard output, stdout.
notrctbl The Capture program messages are not logged in the trace table.
autostop The Capture program terminates after it has captured all transactions logged before the Capture program was started.
logreuse The Capture program reuses the log file (*.ccp) by first deleting it and then re-creating it when the Capture program is restarted. If you do not specify this option, the Capture program appends messages to the log file, even after the Capture program is restarted.
logstdout The Capture program sends all messages to both the standard output (stdout) and the log file.
allchg  (default)  Specifies that an entry is made to the CD table whenever a source table row changes.
chgonly Specifies that an entry is made to the CD table when a source table row changes only if the columns defined for replication (CD table columns) change values.

Scheduling Capture for UNIX platforms

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

at 3pm Friday asnccp warmns noprune

Stopping Capture for UNIX platforms

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

Stop the Capture program before removing or modifying an existing replication source.

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

or

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

To use the stop command, do the following from a window where the Capture program is not 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).
    Note:You do not need to set the value of DB2DBDFT if you specify a value for src_server when you run the command.

  3. Enter the command.

Attention: Follow the 3 steps listed above to enter all of the Capture program commands.

Suspending Capture for UNIX platforms

Use the suspend command to relinquish operating system 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.

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

or

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

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

Resuming Capture for UNIX platforms

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

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

or

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

Reinitializing Capture for UNIX platforms

Use the reinit command to begin to capture changes from new source tables if you add a new replication source or ALTER ADD a column to a replication source and CD table while the Capture program is running. The reinit command tells the Capture program to obtain newly added replication sources from the register table.

reinit also rereads the tuning parameters table for any changes made to the tuning parameters.

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

or

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

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

Pruning the change data and unit-of-work tables

Use the prune command to start pruning the CD and UOW tables.

This command prunes tables once.

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

or

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

The Capture program issues the message ASN0124I when the command is successfully queued.

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

Displaying captured log progress

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

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

or

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

Tip: The DB2 UDB Find Log Sequence Number command (db2lfsn) enables you to identify the physical log file associated with the log sequence number. You can use this number to delete or archive log files no longer needed by the Capture program. For more information, see the IBM DB2 Universal Database Command Reference.


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

[ DB2 List of Books | Search the DB2 Books ]