Overview of using a change management script

You can change a database by using a change management script, which is a set of changes that a user, or group of users, wants to make at a single point in time.
The process of using a change management script to change a database consists of the following steps:
  1. Specifying your changes
  2. Generating your change commands
  3. Running your change commands
  4. If necessary, undoing your change commands
The Change Management Script Editor contains the following sections that you can use to help you change your database and manage the impact of those changes.
Working with Objects
In the Objects to be Changed list in the Working with Objects section, you can create and view changes to the database objects. The Change Management Script Editor will automatically generate commands to implement these changes so that dependencies, side effects, and impacts are handled. You can use the Add Objects button in the upper right corner of the Objects to be Changed list and the Add Objects wizard that the button starts to add objects to be created, altered, or dropped to the list of changed objects.

To change the attributes of any object in the list that is being created or altered, you can select the object, go to the Properties view (which, by default, is near the bottom in the Database Administration perspective), and use the tabs in the Properties view to review and change the attributes of the object.

When you change objects in the Objects to be Changed list, the Impacted Objects list to the right is populated with a list of objects that will be impacted by your changes. The Impacted Objects list can provide you with a complete picture of the effects that your changes will have on the database and help you to determine the best way to handle the outcome.

Optim™ Database Administrator attempts to leave objects in a valid state by re-creating them or rebinding packages. However, it does not automatically update views, trigger bodies, user-defined function bodies, stored procedure bodies, or materialized query table SQL. You can inspect these objects in the Impacted Objects list. You can use the Alter and Drop buttons to move an impacted object to the Objects to be Changed list. You can use the Properties view to change any impacted object that you moved over to be altered.

Commands
Click the Preview Commands link to see the change commands that Optim Database Administrator generates and that will be issued to the database. A change command can be an SQL statement, a DB2® command, or a utility invocation. When you click the Preview Commands link, the focus in the Change Management Script Editor shifts to the Commands section where the generated commands are displayed.
In the Commands section, you can click the following buttons to take the associated actions:
Table 1. Buttons and their associated actions in the Commands section of the Change Management Script Editor
Button Description and action
Data Options Starts the Customize Data Preservation wizard. If the changes are destructive and data must be unloaded and reloaded, you can use this wizard to customize the methods for unloading and reloading data, the unload commands, and the reload commands. You can also specify which maintenance commands are generated.
Summary of Changes Opens the Summary of Changes report in a browser window. The Summary of Changes report lists all of the changes that will be made and the impact that those changes will have on the database, which allows you to take appropriate action before you deploy the changes to the database.
Run Issues the change commands to the database. The focus in the editor shifts to the Messages section, where you can monitor the progress of the commands as they run.
Edit Opens the change commands in the SQL and XQuery Editor where you can edit them. Any changes that you make in the SQL and XQuery Editor are not automatically saved to the change management script. You can run the changed commands directly from the SQL and XQuery Editor by using the Run SQL action that is available when you right-click in the editor. Or, you can run the commands from the file to which they are saved.

The file is saved in the SQL Scripts folder in the project that was created for the change management script.

Edit Undo Opens the undo change commands, which Optim Database Administrator automatically generates, in the SQL and XQuery Editor where you can preview them.

You can also edit the undo commands in the SQL and XQuery Editor. However, any changes that you make in the SQL and XQuery Editor are not automatically saved to the undo change management script. You must run the changed undo commands from the SQL and XQuery Editor or from the file to which they are saved.

The file is saved in the SQL Scripts folder in the project that was created for the change management script.

Save Saves the commands to a script that can be run from a data server. The commands are modified as necessary to be run from the data server.
Messages
The Messages section of the Change Management Script Editor displays the status of the change commands. This section also allows you to follow the progress of the change commands as they run and to review messages about each command. If a command fails, the message number or SQL code and message text are displayed. You can click the message number to open an information center to get more detailed information about the message.

If the commands deployed successfully, the Undo and Save Undo buttons are active. If you decide that you want to back out the changes, you can click Undo to reverse the changes that were made to the database. You can also click Save Undo to save the undo change commands to a script that can be run from a data server.

If an error occurs and the commands are not deployed successfully, you can take one of two actions:
  • Click Undo to undo all of the commands in the change management script that completed before the error occurred.
  • Resolve the issue that caused the error, and then click Restart. The wizard to restart the change commands from the point of failure starts. On the Change Command page of the wizard, you can edit any commands that are displayed, as necessary, and then run the commands from the point of failure.
Tip: To change which information center is used to display detailed message information, click Window > Preferences. Expand the Information Center Home node. Then, click For DB2 for Linux, UNIX, and Windows to see the available options.

When you create a change management script to manage the changes to database, a Data Design Project is created in the Project Data Explorer. The name of the project is typically the name of the database connection. The change management script is stored in both the SQL Scripts folder in the project that was created in the Project Data Explorer and in the Change Management Scripts folder of the database in the Administration Explorer.

You can also reset and reuse change management scripts. After you have deployed your changes to a database, you can reuse the same change management script to deploy another set of changes. To reuse a change management script, you must reset the change management script by selecting Reset from the Change Management menu. The reset operation cleans up the change management script so that it can be used for a new set of changes.


Feedback