Recovering after a DMSII Reorganization
Use this procedure if the Client stops because of a DMSII reorganization that changes record layouts. The only time you need to repeat this procedure is if there is another DMSII reorganization that changes record layouts.
Note: The client automatically creates an unload file in the data source's working directory. This file backs up the client control tables after a process command detects a DMSII reorganization and the redefine command is run. The unload file is named source_reorg_nnn.cct where source is the name of the data source (in uppercase) and nnn is the value of the update_level prior to running the redefine command. This value is saved in the old_update_level column of the DATASOURCES entry.
- Alter your user scripts as required by the host layout changes. For example, if you want to convert the data that appears in a new column to a relational database date/time item, create this script now, before you run the redefine command.
- If you have modified the scripts generated by the DATABridge Client, it is recommended that you save these scripts in case any of them are regenerated after you run the redefine command.
- Run the redefine command as follows:
dbutility redefine datasource
The redefine command does the following:
- Determines which data sets have a changed layout and updates the ds_mode accordingly.
- Runs your user scripts to preserve your changes to the client control tables.
- Creates reorganization scripts that will alter the relational database tables to match the changes in the reorganized DMSII data sets.
Important: If some of the changes caused by the reorganization are not supported, the redefine command does not create the reorganization scripts. Instead, it sets ds_mode to DBV_MODE_CLONE(0), which forces the dataset to be recloned. If the changes caused by the reorganization are allowed, the redefine command sets ds_mode to DBV_MODE_NEEDREORG (31).
The redefine command automatically creates a backup copy of the client control tables for the data source being redefined. This is done once after the reorganization is detected. The SRC_NotBackedUp bit in the status_bits column of the DATASOURCES tables signals whether a backup has been created. This bit is set by the process or the clone command after updates are successfully processed. The redefine command examines the value of this bit in the status_bits column. If it is set, it clears it and backs up the client control tables using an unload command. If the bit is not set, indicating that the client control tables have been backed up, the define command does not back them up again, as this would wipe out the good backup. A file named datasource_reorg_nnn.cct is created in the working directory before the first redefine command was run, where nnn is the update level of the DMSII database and datasource is the name of the data source. (This value is saved in the old_update_level column of the DATASOURCES entry.)
- If the redefine command get errors because of improperly updated user scripts, you need to run a reload command. This restores the control tables using the unload file. You can then correct the user scripts and rerun the redefine command until you get it work.
- Examine the reorg scripts created by the redefine command to make sure they are correct before proceeding any further. These scripts are created in the working directory and have names of the form script.reorg_nnn.tablename, where nnn is the old update level of the DMSII database. The alter commands are not reversible. Therefore, we recommend that you back up your relational database before executing a reorg command.
- Unless you are confident that the reorg scripts are safe, we recommend that you back up the relational database.
- Run the reorg command as follows:
dbutility reorg datasource
The reorg command does the following:
- Generates new Client scripts for all data table changes.
- Restores ds_mode to its value before the reorganization for all relational database tables that are successfully updated by the reorganization scripts. A ds_mode of 2 (or 1) indicates that the data set is ready to be updated.
- Sets ds_mode to 33 for the relational database tables that failed to update with the reorganization changes. You must manually update these tables to match the new layout that resulted from the DMSII reorganization.
- Run a process command to resume change tracking:
dbutility process datasource