Help SQL Replication

Customizing and running SQL scripts for replication

To create control tables, register source tables, and create subscription sets and members, you must run SQL scripts that are generated by the Replication Center and ASNCLP command-line program. You can run the SQL scripts by using the Replication Center or you can run them from a DB2® command line. If necessary, you can modify the SQL scripts to meet your needs.

Before you begin

If you run the SQL scripts from a DB2 command line, you must connect to servers manually when you run the SQL script, edit the SQL statements to specify the user ID and password for the server to which you are connecting. For example, look for a line that resembles the following example and add your information by typing over the placeholders (XXXX):

CONNECT TO srcdb USER XXXX USING XXXX ;

About this task

You have the option in the ASNCLP and Replication Center to run a generated SQL script immediately or to save the generated SQL script to run later. Even if you choose to run the SQL now, you might also want to save it for future reference. For example, if you save the definitions of a large replication subscription set in an SQL file, you can rerun the definitions as necessary.

When editing the generated SQL scripts, be careful not to change the termination characters. Also, do not change the script separators if there are multiple scripts saved to a file.

You might want to customize the SQL scripts for your environment to perform the following tasks:
  • Create multiple copies of the same replication action, customized for multiple servers.
  • Set the size of the table spaces or databases of the CD tables.
  • Define site-specific standards.
  • Combine definitions together and run as a batch job.
  • Defer the replication action until a specified time.
  • Create libraries of SQL scripts for backup, site-specific customization, or to run standalone at distributed sites, such as for an occasionally connected environment.
  • Edit create table and index statements to represent database objects.
  • For Informix® and other non-DB2 relational databases, ensure that tables are created in the dbspaces or table spaces that you want.
  • For Microsoft SQL Server, create control tables on an existing segment.
  • Review and edit subscription-set member predicates as a way of defining multiple subscription sets at one time. You can use substitution variables in your predicates and resolve the variables with programming logic.

Procedure

Use one of the following methods to run the files containing SQL scripts from a DB2 command line:


Send your feedback | Information roadmap | The Q+SQL Replication Forum

Update icon Last updated: 2013-10-25