Change relationship names in a Database?

Document ID : KB000014362
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

Global change sets  can be created and maintained that define changes that you want to be applied globally to objects during analysis processing, including 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.

Question:

Is there a simple way to change 200 relationship names in a Database?

Environment:
DB2 for Z/os
Answer:

Relationship names can be changed via Global Changes assuming the change can be implemented via a mask 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 "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: