Replication Guide and Reference
To define a subscription to copy the changes from DEPARTMENT, the
source table, to the target table named DEPARTCOPY:
- From the Replication Sources list displayed in 8 above, click mouse button 2 on the DEPARTMENT object on the right
pane of the Control Center, then select Define subscription. The Define Subscription
window opens.
- Set up the target table and subscription definition.
- Type DEPTSUB in the Subscription name field.
- Type COPYDB in the Target server field. This database is where the target table will reside.
- Type DEPTQUAL in the Apply qualifier field. The
character string identifies the subscription definitions unique to each
instance of the Apply program that will run this subscription.
- Type DEPARTCOPY over the default name of the target table. The
Control Center adds a table qualifier prefix to the target table name.
- Specify that you want to create the target table by selecting the
Create table check box for the DEPARTCOPY target
table.
- Click on the Advanced push button. The Target Type page of the
Advanced Subscription Definition notebook opens.
- Select the User Copy radio button.
- Click on the Target Columns tab.
- Select the check box under Subscribe for XDEPTNO.
- Check the Primary key check box next to DEPTNO.
- Click on the Rows tab and type the following WHERE
clause:
DEPTNO >='A00'
- Click on OK to save these settings and return to the Define
Subscription window.
- Define SQL statements to be processed during subscription run time:
- Click on the SQL push button. The SQL window opens.
- Click on the Add push button. The Add SQL window opens.
- Type the following processing statement in the SQL statement
field:
DELETE FROM ASN.IBMSNAP_APPLYTRAIL
WHERE LASTRUN < (CURRENT TIMESTAMP - 1 DAY)
- Type the SQLSTATE value 02000 in the SQLSTATE field
and click on Add. This value is added to the Acceptable
SQLSTATE values list box.
- Click on the radio button that indicates you want to submit the statement
before the subscription is processed.
- Click on OK. The statement is added to the list box in the SQL
window and the Add SQL window closes.
- Click on OK to return to the Define Subscription window.
- Specify when and how often to replicate the subscription by clicking on
the Timing push button. The Source to Target page of the
Subscription Timing notebook opens.
- Keep the current date in the Start date field.
- Keep the current time in the Start time field.
- Select the Time-based check box and the Using relative
timing radio button.
- Use the spin buttons on the Minutes field to select 1-minute
intervals.
- Use the spin buttons on the Hours field to change the default
number to 0.
- Click on the Data Blocking tab.
- Click on the spin buttons and select 5 as the number of minutes at a time
that Apply will copy committed data.
- Click on OK to save these values and return to the Define
Subscription window.
- Click on OK to submit the subscription. The Subscription Information window opens.
- Type in COPYDB.
- Select the Save to SQL file and run later radio button and
click on OK.
- Type the file name where you want to save the file in the Run SQL files
window and click on OK.
- Click on OK in the DB2 message window to save the values and
close the Define Subscription window.
- Click mouse button 2 on the Replication Subscriptions folder under the SAMPLE database and select Run SQL files.
- Run the SQL file you named above.
- Click on OK in the DB2 message window when the message appears
that this file has run successfully.
- Click mouse button 1 on the Replication Subscriptions folder
under the SAMPLE database. The DEPTSUB subscription appears as an instance on
the contents pane of the Control Center.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]