Start of change

Migrating data

You can use the Migrate Data wizard, which can be invoked from the Deployment Script Editor, to generate the change commands that are necessary to copy data. Those commands can then be deployed to the database.
Prerequisite: A deployment script for the database to which you plan to move data must exist.
To copy data, complete the following steps:
  1. Open the deployment script in the Deployment Script Editor.
  2. Click the Change Commands tab to display the Change Commands page.
  3. On the Change Commands page, click Generate Data Migration. The Migrate Data wizard starts.

    Complete the steps in the wizard to generate your commands. The wizard takes you through steps to specify information for:

    1. Selecting the data migration options.

      You can either generate the change commands so that the files are standalone or so that they are integrated into the deployment script. When you generate them to be standalone, you deploy them to the database by right-clicking the change command file in the Data Project Explorer, and clicking Run SQL. When you have them integrated into the deployment script, you can deploy them to the database from the Deployment Script Editor.

    2. Selecting the source connection.

      You must identify a connection for the database from which you want to copy data.

    3. Specifying file information.

      You must specify a directory for the export and import commands that will be generated for copying the data from the source database to the target database. You can change the method that will be used to unload and reload the data.

    4. Specifying the mapping tables.

      The wizard includes pages for specifying information for generating the export and import commands. You must identify the pairs of tables from which to save data and into which to load the saved data. Use the Add New Entry icon to add a table entry.

    5. Customizing export and import commands for data migration.

      You can customize the commands that unload and reload the data and map the columns between tables.

    6. Merging change commands.

      If you chose to have the change commands generated so that they are integrated into the deployment script and the deployment script contains other change command files, you are prompted to merge the changes from the Previous Change Commands side of the Merge Editor to the Proposed Change Commands side of the editor. Merge the commands, ensuring that referential integrity is preserved. That is, ensure that the parent table in any referential integrity relationship is loaded before the child table.

  4. Deploy the change commands to copy the data from the source database to the target database, using one of the following methods:
    • If you generated the change commands to be standalone:
      1. In the Data Project Explorer, right-click the change commands file that contains the export commands, click Run SQL, and complete the steps in the Deploy Change Commands wizard. Repeat this for each export file.
      2. Right-click the change commands file that contains the import commands, click Run SQL, and complete the steps in the Deploy Change Commands wizard. Repeat this for each import file.
    • If you generated the change commands to be integrated with the deployment script:
      1. With the deployment script open in the Deployment Script Editor, click the Change Commands tab to display the Change Commands page.
      2. On the Change Commands page, click Deploy Changes to the Target Database .
      3. Complete the steps in the Deployment wizard to deploy the changes. The changes for all of the change command files that are contained in the deployment script are applied.
There is no way to automatically back out migrated data because you cannot generate undo commands for data migration. However, if you deploy undo commands to roll back the changes that you have made to a database and a table is dropped and re-created as part of the undo, any data that you have copied over is effectively lost.
Related concepts
Data preservation
Related tasks
Copying databases using a deployment script


Feedback

Copyright IBM Corporation 2006, 2007. All Rights Reserved.
End of change