Minimize downtime when rebuilding a database

The following steps help you rebuild a database while minimizing downtime. This can be especially useful if your database is in operation 24 hours a day.

It is wise to do a practice run of steps 1-4, and determine the times required for each step, prior to beginning the actual rebuild. You may also want to save copies of your files at various points during the rebuild.

Caution

Make sure that no other scheduled backups rename the production database's log. If this happens in error, you will need to apply the transactions from these renamed logs to the rebuilt database in the correct order.

To minimize the downtime during a rebuild
  1. Using dbbackup -r, create a backup of the database and log, and rename the log.

    For more information, see Backup utility (dbbackup).

  2. Rebuild the backed up database on another computer.

  3. Perform another dbbackup -r on the production server to rename the transaction log.

  4. Run dbtran on the transaction log and apply the transactions to the rebuilt server.

    For more information, see Log Translation utility (dbtran).

    You now have a rebuilt database that contains all transactions up to the end of the backup in Step 3.

  5. Shut down the production server and make copies of the database and log.

  6. Copy the rebuilt database onto the production server.

  7. Run dbtran on the log from Step 5.

    This should be a relatively small file.

  8. Start the server on the rebuilt database, but do not allow users to connect.

  9. Apply the transactions from Step 8.

  10. Allow users to connect.