Copying databases using a deployment script

Copying databases using a deployment script is a technique that allows flexibility and provides more structure and automation than manually creating script files.
Prerequisite: Creating a deployment script requires being able to connect to the database. Therefore you must create the new database manually.

Once the database is created, create a deployment script to configure the database copy. Copy the structural database objects from the source model to the target model. If copying data is desired, export the source data. Implement change commands (what amounts to the DDL. If copying data is desired, generate commands to import the data into the target.) Click Generate Change Commands on the Change Commands tab of the Deployment Script Editor to generate these statements. Deploy the change commands that are defined in the deployment script.

To copy a database using a deployment script, complete the following steps:
  1. Create a deployment script. For instructions on how to create a deployment script, see Creating a deployment script.
  2. Copy your database objects. To copy the structural objects, add the source model that you want to copy to the Physical Models page by clicking Add.
    Optional: You can also get the source model by dragging it from the Database Explorer into your project or by selecting File > New > Physical Data Model.
    Select the model and click Migrate to display the Comparison Editor. Use the Comparison Editor to move objects from the source to the target. If additional changes or configuration are required, those changes can be made by clicking Edit Target Model on the Physical Models page of the deployment script.
  3. Migrate your data. For more information about migrating data, see the Migrating data topic.
  4. Generate your change commands. To generate commands, open the deployment script for the target database. On the Change Commands tab, click Generate Change Commands. Click Generate Delta DDL to generate DDL commands that create the structural objects defined in the target (that were either copied from the source model in the comparison editor or changed manually in the target model). Because this is a new database you might not need to select the Enable Undo option. Similarly, you do not need to select Enable Data-Preservation because the database most likely does not contain any data. If you do want to move data, the import script that was generated can be added to the Change Commands page of the target deployment script.
  5. Deploy your change commands After you have created all the change commands, click Deploy Change Commands to copy the database structure and data.
Related concepts
Scenario: Changing in place
Related tasks
Generating change commands from the Deployment Script Editor
Migrating data


Feedback

Copyright IBM Corporation 2006, 2007. All Rights Reserved.