Change relationship names in a database using RC/Compare
search cancel

Change relationship names in a database using RC/Compare

book

Article ID: 14362

calendar_today

Updated On:

Products

RC Compare for DB2 for z/OS RC/Migrator for DB2 for z/OS

Issue/Introduction

Global change sets can be created and maintained that define changes that are to be applied globally to objects during analysis processing. These include changes
for plan and package attributes and many others including RI Relationship Names. Global change sets can be used repeatedly when analyzing migration, alteration,
and comparison strategies. The changes are automatically propagated to all dependent objects. Global changes can also be used to delete attributes and DDL
statements from the analysis output.

Is there a simple way to change 200 relationship names in a database.

Resolution

Relationship names can be changed via Global Changes assuming the change can be implemented via a mask and assuming it can be set to match the majority of the relationship names that require to be changed.

Create a migration strategy and use the Analysis Options, "Exclusive Options" , "BND/DAT/STA/SQL/GRNT/RI ==> I".
"I" means that the analysis will only generate ALTER statements for the RI.

Then set up a global changes set to change the Relationship names using a mask such as:

CODE   DESCRIPTION

TBRN    REL NAME
FROM    SN%                               TO ST%

This will change all relationship names that start with the letters SN to ST.

Before:

ALTER   TABLE authid.SNTABLE1
        ADD CONSTRAINT SNRELNM FOREIGN KEY
            (COL1
            )
        REFERENCES AUTHID.SNTABLE2
            (COL1
            )
        ON DELETE RESTRICT
        ENFORCED;

After:

ALTER   TABLE AUTHID.SNTABLE1
        ADD CONSTRAINT STRELNM FOREIGN KEY
            (COL1
            )
        REFERENCES AUTHID.SNTABLE2
            (COL1
            )
        ON DELETE RESTRICT
        ENFORCED;


In the Analysis Report you will see:
Table Changes for:
Creator: AUTHID
Name:    SNTABLE1

------------ Foreign Key Changes ---------------------
Attribute   Status        Value
---------   -----------   ----+----1----+----2----+----3--
RELNAME     Currently:    SNRELNM
            Changed To:   STRELNM

Additional Information

Define Global Change Sets

Knowledgebase Document: Use of Global Changes in RC/Migrator