IBM Books

Replication Guide and Reference


Operating Capture for Windows and Capture for OS/2

An administrator can use the commands in this section to operate the Capture program on Windows and the Capture program on OS/2. Enter the commands or a key combination from an NT or an OS/2 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 Windows and OS/2

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

To start the Capture program using the NT Services:

  1. Select Replication from the NT Services window.

  2. Click the START push button. The Capture program starts according to the ASCII file information you provided.

You can also start the replication service by typing STRTSERV on the NT command line.

To start the Capture program using the DB2 command window:

  1. If you created one or more DB2 for NT or DB2 for OS/2 instances, use the SET command to set the DB2INSTANCE environment variable to the DB2 for NT or DB2 for OS/2 instance with which you plan to run the Capture program:
    SET DB2INSTANCE=database_instance_name
    

    While the Capture program is running, a file with the name <database_instance_name><database_name>.CCP (Windows) or database_name.CCP (OS/2) 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.

  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. To start the Capture program, enter the ASNCCP command from the Windows or OS/2 window where you issued the SET command. The syntax is:
>>-ASNCCP----+------------+---+--------+---+---------+---------->
             '-src_server-'   +-WARM---+   +-PRUNE---+
                              +-WARMNS-+   '-NOPRUNE-'
                              '-COLD---'
 
>-----+---------+---+---------+---+----------+---+----------+--->
      +-NOTRACE-+   '-TRCFILE-'   '-NOTRCTBL-'   '-AUTOSTOP-'
      '-TRACE---'
 
>-----+----------+---+-----------+---+---------+---------------><
      '-LOGREUSE-'   '-LOGSTDOUT-'   +-ALLCHG--+
                                     '-CHGONLY-'
 

Table 29 defines the invocation parameters.

Table 29. ASNCCP Command Invocation Parameter Definitions for Windows and OS/2 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 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 Windows and OS/2

For Windows: Use the AT command to start the Capture program at a specific time. For example, the following command string starts the Capture program for Windows at 15:00:

c:\>AT 15:00 /interactive "c:\SQLLIB\BIN\db2cmd.exe c:\CAPTURE\asnccp.exe warmns"

Before you enter the AT command, the Windows Schedule Service should already be started.

For OS/2: Use the Alarms program in the OS/2 Productivity set to start the Capture program for OS/2 at a specific time.

Stopping Capture for Windows and OS/2

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 for modifying an existing replication source.

For Windows: If you started the Capture program as an NT service, stop the Capture program by selecting Replication from the NT Services window and clicking the Stop push button. After the stop message appears, the status field becomes blank.

For Windows and OS/2: If you started the Capture program from the DB2 command window, enter the following command:

>>-ASNCMD--STOP------------------------------------------------><
 

or

>>-ASNCMD--src_server--STOP------------------------------------><
 

To use the 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 same 3 steps listed above to enter all of the Capture program commands.

Suspending Capture for Windows and OS/2

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 Windows and OS/2

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 Windows and OS/2

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 ]