DB Upgrade Utility

Download  dbupgrade.tar.Z  approx. 16K: (for Unix)
Download  dbupgrade.zip      approx. 13K: ( for NT)

Copyright © 1999 Martin Wilkinson
Designed and developed by Simon Maxen

Introduction

These scripts operate on a reference schema and a target schema to generate a script that if run against the target schema will bring it in line with the reference schema.

This utility is useful when wanting to upgrade a database to a known state from an unknown state. A database may be in a unknown state because:

Overview

The target schema is in line with the reference schema when:

Requirements

Instructions

  1. Download the upgrade scripts from the web site. The scripts are available either as a ZIP file (DBupgrade.ZIP, 12K) or, for Unix users, as a compressed tar file (dbupgrade.tar.Z , 15K). Both compressed archive files contain exactly the same thing.
  2. Unzip or uncompress and untar the compressed archive file in the <upgrade dir>.
  3. Important: Make a backup copy of the target schema.
  4. Edit the upgrade_db.sql script making the following changes:
  5. As the upgrade Oracle user generate the target upgrade script by running the command below redirecting the output to a target schema upgrade script.
    sqlplus -s @ upgrade_db.sql <reference schema> <target schema> <upgrade dir>

  6. Inspect the target schema upgrade script investigating any unexpected operations. The following sections will be present in the file:
  7. If any tables were missing from the target schema ensure that the target schema owner is granted permission to select from the missing tables in the reference schema.
  8. As the target schema owner run the target schema upgrade script investigating any problems.
  9. As the upgrade Oracle user re-generate the target upgrade script.
  10. Inspect the script to ensure it does not contain any DDL commands.
  11. The upgrade is now complete.

Avoiding error messages

One benefit of the output script is that it generates a series of DDL commands that can be inspected by hand prior to running on the database. This visibility helps re-assure DBA's that the script is not going to do anything unwanted to the database. One consequence of this is that if an index is dropped automatically by Oracle as a consequence of dropping another object an error will result when the index is dropped by the script. To get around this problem run the upgrade in two passes. On the first pass delete all DDL commands in the target schema upgrade script from the start of the index deletion onwards. On the second pass run as normal, no errors should be generated.

A note on performance

This utility is primarily concerned with upgrading the integrity of the target schema. DBA's can fine-tune the indexes by making modifications to the target schema upgrade script. Note that currently there is no guarantee that the order of columns in a created index will match that of the reference schema. This work is left as a future enhancement.

Last updated 20May 1999

Download  dbupgrade.tar.Z  approx. 16K: (for Unix)
Download  dbupgrade.zip       approx. 13K: ( for NT)