Changing Source Tables

If the shape of a source table from a deployed replication changes (columns are added or deleted or a data type is changed), the source table will need to be re-imported into the CDD and the column mappings for the replication will need to be updated to reflect the new shape of the source table.

 

This is a sample showing the steps for adding a column to a source table and deploying that change to the replication server:

 

In this example, we have a source table with the following definition

Source_Change_CDD_Before.bmp

 

This table is deployed and replicating to a target table of the same name on SQL Server.  If the column PHONE is added to the Adabas file, the table will need to be re-imported to reflect this new column.

Source_Change_CDD_After.bmp

 

After re-importing the table, save the CDD and exit the CDD Manager.  Open the CDD in the Replication Administrator.  On the Replication Design tab, select the replication that contains the source table that was changed and press the Map Columns button.

 

On the Map Columns dialog, the new PHONE column appears on the source side but is not mapped to anything on the target.

Source_Change_New_Column_Map_Before.bmp

 

Since the target table exists and does not contain a corresponding column, it needs to be dropped and re-created.  To drop the target table, press the Drop Target Table button.  This will create new default metadata for the new target table and automatically map the new column to the target.

Source_Change_New_Column_Map_After.bmp

 

Press Done to accept the new column mapping.  On the Replication Design screen, the target table will have the Create check box checked.

You will now need to re-deploy the replications.  The target table will be created as part of the deploy process.  Alternatively, pressing the Build Targets button will create the new target table.

 

Note: If you are not using the Replication Administrator to create the target table, you will need to manually make the same change on the source table and re-import that table as well.  In this case, skip the step of dropping the target table and map the new column manually.  In this case, the target table will not be created at deploy time.

 

Note: Due to the internal record keeping mechanisms, it is possible for the Replication Administrator to not recognize an altered table as being the same as one that was already deployed.  In this situation, it will recognize the replication or replications that contain the old form of the table or tables and will remove those replications.  In this situation, a message will appear when the Replication Administrator is started informing you that there are replications that cannot be resolved to existing tables and will be removed.  You will need to press Add Tables to re-add these replications.  After adding the replication, you must adjust the target table to the existing table name and then follow the steps for mapping the new column.

 

Note: This sample illustrates how to update a replication when a new column has been added.  The same concepts apply for removing columns or changing data types.