When the differences between two databases are difficult
to determine, using the Compare Editor to find and move those differences
makes it easier to migrate changes from one database environment to
another. In addition to a database connection, the source of the changes
can also be a physical data model or a DDL script file.
Before you begin
A connection must exist to the database to which you want
to migrate changes. If the source of the changes is a database, a
connection must exist to that database.
Procedure
To migrate changes from a source (database connection,
physical model, or DDL file) to another database by using the Compare
Editor, complete the following steps:
- Create a change management script. In the Administration
Explorer, right-click the Change Management
Scripts folder for the database that you want to migrate
changes to and click New Database Change. A new change management script is created, and the change
management script is displayed in the Change Management
Script Editor..
A data design project is automatically
created in the Data Project Explorer. The name
of the data design project is the name of the database connection.
If a data design project with the name of the database connection
exists, the name of the new data design project is the database connection
name with a numeric suffix. The data design project contains and manages
the resources that are necessary to implement the changes to the actual
database.
Tip: To reuse an existing change management
script, complete the following steps to reset the script:
- If the change management script is already open, click the tab
for the script to ensure that the script is highlighted. Otherwise,
in the Administration Explorer, expand the Change
Management Scripts folder. Double-click the change management
script that you want to open.
- From the main menu, click .
- From the main menu, click . The Migrate Objects to
Target Model wizard starts.
- Complete the steps in the wizard, and click Finish.
You can do these actions in the wizard:
- Specify the source from which to migrate the changes.
- Specify the objects that you want to migrate. For example, you
can choose to migrate buffer pools, partition groups, schemas, table
spaces, users, and groups.
- Define masks and ignores to simplify what is included in the comparison.
- Use Next Difference ()and Previous
Difference (buttons in the toolbar in the structural comparison
table to drill down through the objects to identify the differences
between models of the source and target database. Use the Copy
from Left to Right () button in the toolbar to copy a difference that you want
to apply to the target database.
After you click Finish,
the Change Management Script Editor shows the
list of objects that were migrated to the database and the changes
that will be made to the database.
- In the Change Management Script Editor,
assess any other objects that might be impacted by migrating the changes
to the target database.
- In the Objects to be Changed list,
click each object. Objects that are affected by the objects that are
being migrated are displayed in the Impacted Objects list.
- Include impacted objects in the change management script.
Use the Alter and Drop buttons
to move the impacted objects to the Objects to be Changed list.
If you use the Alter button to move an impacted
object, you can click the object and make any necessary changes to
the object in the Properties view.
- Click Preview Commands to display
the generated commands in the Commands section
and review the commands.
To review a summary
of the changes that will be made to the database, click View
Change Report.
- Click Data Options to
start the Customize Data Preservation wizard
and complete the steps in the wizard. You might want to
customize commands when changes to a table require that the table
be dropped and then re-created for any of the following reasons:
- To modify the location of the data files
- To change the load and reload methods
- To redefine the query for unloading the data
- To correct mismatches between the data types of unload and reload
columns
- To remap how the data is loaded
You can also specify which DB2 maintenance commands are generated.
- Review the regenerated commands.
- Click Run to start the Deploy
Change Commands wizard.
- Review the change commands and click Finish to
deploy the changes to the actual database catalog.
Results
You have migrated structural database changes from one database
environment to another. When you use the
Compare Editor to
migrate changes, you can migrate only structural database changes.
To migrate data from other objects, you must complete additional steps.