IBM Books

Replication Guide and Reference


General steps for setting up replication

Generally, each function in DJRA consists of five steps:

  1. Select the function that you want (for example, Define One Table as a Replication Source or Add a Member to Subscription Sets). A window opens.

  2. If applicable, edit DJRA logic to affect the statements that are created when you generate SQL by selecting the Edit Logic, Edit Predicate Logic, or Edit Create Table Logic push button from the DJRA function window. See Editing DJRA logic for more information.

  3. Generate the SQL.

    1. Provide the required information, as prompted in the displayed window.

    2. Create the SQL by clicking Generate SQL. SQL is generated into a file but not run yet.

  4. Review and edit, if needed, the generated SQL file from the console window or by clicking Run or Edit an SQL file from the primary window.

  5. Run the SQL file by clicking Run or Edit an SQL file and then clicking Run from the primary window or by clicking Run from the console window.

    Make sure that you run or save your generated SQL files before generating another set of SQL files. If you do not run your SQL after it is generated, DJRA might generate duplicate names for objects. See Running DJRA-generated SQL for more information.

Editing DJRA logic

You can edit the following files: SRCESVR.REX, TARGSVR.REX, CNTRLSVR.REX, and TBLSPACE.REX.

SRCESVR.REX
Specifies the owner and name of the CD or CCD table and the table space in which the CD or CCD table is placed. Define one or multiple tables as replication sources and click Edit Logic to edit SRCESVR.REX before you generate SQL.

CNTRLSVR.REX
Specifies the criteria by which rows from the source table can be replicated to the target. You can specify which columns in a source table are eligible for replication. You also can specify values to search individual source tables and replicate only the data that matches the value criteria. Add one or multiple members to subscription sets and click Edit Predicate Logic to edit the CNTLSVR.REX file.

TARGSVR.REX
Specifies the table space or segment in which to create target tables. Check this file to make sure that the table spaces are being defined in the location of the target database where you want them. Add one or multiple members to subscription sets and click Edit Create Table Logic to edit the TARGSVR.REX file.

TBLSPACE.REX
Specifies the table spaces for the control tables and the UOW table. Check this file to make sure that the table spaces are being defined in the location where you want them. Select Create Replication Control Tables and click Edit Tablespace Logic to edit the TBLSPACE.REX file.

You can specify where table spaces are created in the SRCESVR.REX and TARGSVR.REX files by changing the default directory (C:\) to the directory that you prefer. When you type in your directory, make sure that you add a backslash (\) after the directory. For example, if you are changing the directory from C:\ to F:\Test\, make sure that you type a backslash before the word Test and after the word Test. If you just type F:\Test, an error will occur when you attempt to generate SQL.

Editing DJRA-generated SQL

You can edit DJRA's SQL from the console window or by clicking Run or Edit an SQL file from the primary window. You can edit the SQL for several reasons. For example, you might want to:

When editing generated SQL, be careful not to change special markers that DJRA places within the SQL. For example, :ENDOFTRIGGER: or :ENDOFPROCEDURE: is part of a comment that is necessary for DJRA to run successfully. Altering create trigger blocks can result in incorrect SQL that ends in error when run.

Running DJRA-generated SQL

The Run SQL push button is intended to be used for SQL generated by DJRA. SQL that you generate outside DJRA might not run successfully if you use DJRA to start it. Likewise, you might not be able to run SQL generated by DJRA at a DB2 command line.

Recommendation: Run DJRA-generated SQL from DJRA.


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

[ DB2 List of Books | Search the DB2 Books ]