IBM Books

Replication Guide and Reference


Setting up the Capture and Apply programs

Setting up consists of configuring the source, target, and control servers, and setting up NT services on Windows. The following sections provide instructions for configuring each server, providing end-user authentication at the source server, and setting up the NT Service Control Manager.

Configuring Capture for Windows and OS/2

Important: The Capture program is bound automatically during execution. Therefore, the following steps for binding the Capture program on Windows and OS/2 are optional. If you want to specify options or check that all bind processes completed successfully, complete the following tasks:

  1. Log on with the user ID that has sufficient privileges.

  2. Connect to the source server database by entering:
    DB2 CONNECT TO database
    

    where database is the source server database.

  3. Prepare the source server database for roll-forward recovery by issuing the UPDATE DATABASE CONFIGURATION command and the BACKUP DATABASE command. For example:
    DB2 UPDATE DATABASE CONFIGURATION FOR database_alias USING LOGRETAIN ON
    DB2 BACKUP DATABASE database_alias
    

    or:

    DB2 UPDATE DATABASE CONFIGURATION FOR database_alias USING USEREXIT ON
    DB2 BACKUP DATABASE database_alias
    

    You might need to increase DBHEAP, APPLHEAPSZ, PCKCACHESZ, LOCKLIST, and LOGBUFSZ based on your installation requirements.

  4. Change to the directory where the Capture program bind files are located, which is usually drive:\SQLLIB\BND.

  5. Create and bind the Capture program package to the source server database by entering the following command:
    DB2 BIND @CAPTURE.LST ISOLATION UR BLOCKING ALL
    

    where UR specifies the list in uncommitted read format for greater performance.

    These commands create a list of packages, the names of which are in the file CAPTURE.LST.

Configuring Apply for Windows and OS/2

Important: The Apply package is bound automatically during execution. Therefore, the following steps for binding the Apply package on Windows and OS/2 are optional. If you want to specify options or check that all bind processes completed successfully, complete the following tasks:

  1. Log on with the user ID that has sufficient privileges.

  2. Change to the directory where the Apply program bind files are located, which is usually drive:\SQLLIB\BND.

  3. Connect to the source server database by entering:
    DB2 CONNECT TO database
    

    where database is the source server database.
    Note:If the source server database is catalogued as a remote database, you might need to specify a user ID and password on the DB2 CONNECT TO command. For example:
    DB2 CONNECT TO database USER userid USING password
    

  4. Create and bind the Apply program package to the source server database by entering the following commands:
    DB2 BIND @APPLYCS.LST ISOLATION CS BLOCKING ALL
    
    DB2 BIND @APPLYUR.LST ISOLATION UR BLOCKING ALL 
    

    where cs specifies the list in cursor stability format, and ur specifies the list in uncommitted read format.

    These commands create a list of packages, the names of which are in the files APPLYCS.LST and APPLYUR.LST.

  5. Connect to the target server database by entering:
    DB2 CONNECT TO database
    

    where database is the target server database.

  6. Create and bind the Apply program package to the target server database by entering both of the following commands:
    DB2 BIND @APPLYCS.LST ISOLATION CS BLOCKING ALL GRANT PUBLIC
    
    DB2 BIND @APPLYUR.LST ISOLATION UR BLOCKING ALL GRANT PUBLIC
    

    Because the Apply program uses static SQL calls for the control tables, the Apply bind process searches for the control tables at each server that the Apply program is bound to, regardless of whether these control tables are used at a server.

  7. Repeat the connect and bind steps for each server that the Apply program connects to. You must bind the Apply program to all source, target, and control servers.

Providing end-user authentication at the source server

For end-user authentication to occur at the source server, you must provide a password file with an AUTH=SERVER scheme. The Apply program uses this file when connecting to the source server. Give read access only to the user ID that will run the Apply program.

Creating a password file:

The password file must meet the following criteria:

For more information about authentication and security, refer to the IBM DB2 Universal Database Administration Guide.

Setting up the NT Service Control Manager

You can operate the Capture and Apply programs for Windows by using the DB2 command processor or by using the NT Service Control Manager (SCM). The SCM enables you to automatically start the Capture and Apply programs as services from the NT Control Panel.

You must install the replication service manually (installation is not automatic). The following steps explain how to install the replication service and set it up as an NT service.
Tip:In this section, x:\ refers to the drive and directory containing executable programs. These programs are usually located in the \sqllib\bin directory.

To install replication and set up the NT service:

  1. Open a command window, and change to the directory containing the executable file ASNINST.EXE.

  2. Install the replication service by typing the following command:
    ASNINST x:\ASNSERV.EXE
    

  3. Set up the service from the NT Control Panel.

    1. Double-click the Services icon. The NT Services window opens.

    2. Select Replication and click STARTUP.

    3. Ensure that the startup type is automatic.

    4. Specify the local user ID and password and click OK. The user ID must be the one that runs the Capture and Apply programs and has the appropriate DB2 privileges.

  4. Add the environment variable ASNPATH to specify the location of the Capture and Apply program files.

    1. Double-click the System icon on the NT Control Panel. The System Properties window opens.

    2. Click the Environment tab.

    3. Type the ASNPATH string in the Variable field as shown in the following example:
      ASNPATH=x:\
      

    4. Click OK.

    5. You must reboot the computer after updating the value of the ASNPATH environment variable.

  5. Create an ASCII file called ntserv.asn to run the Capture and Apply programs.

    1. Enter the following records in the file:
      db_name x:\ASNCCP parameters
      
      db_name x:\ASNAPPLY parameters
      

      where db_name specifies the name of the source database for the Capture program and the name of the control database for the Apply program, x:\ is the location of the programs, and parameters specifies one or more invocation parameters (such as APPLYQUAL).

      To use the Capture program and Apply program trace facilities, specify the invocation parameters in the file. For example:

      DBNAME1 C:\SQLLIB\BIN\ASNCCP COLD TRACE<CRLF>
      DBNAME2 C:\SQLLIB\BIN\ASNAPPLY APPLYQUAL DBNAME2 TRCFLOW TRCFILE<CRLF>
      

      The TRCFILE invocation parameter is necessary, in addition to the usual trace invocation parameter (such as TRCFLOW), to generate an Apply program trace.

      Do not specify an output file name for traces. These will be written to default locations, with default file names, as follows:

      • For the Capture program:
        x:\instancenamedbname.trc
        

      • For the Apply program:
        x:\APPLYtimestamp.trc
        

    2. Save the file to the following location:
      x:\ntserv.asn
      

The Replication Services program stores all messages in x:\asnserv.log. If you encounter any problems, check this log file for error messages.

To stop the Capture and Apply programs:

Important: After you start the service, the Capture and Apply programs run independently of ASNSERV. Therefore, stopping ASNSERV does not stop the Capture and Apply programs. Use the ASNCMD STOP command in a command window to stop the Capture program. Use the ASNASTOP command in a command window to stop the Apply program.

To remove replication from the NT service:

To remove Replication Services from the NT Control Panel, run the ASNREMV program.


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

[ DB2 List of Books | Search the DB2 Books ]