UWMLSC > Beowulf Systems > Medusa
  

Restoring a Database

To make it a little easier to run a DB2 database restore, we created the Perl script restoreDB.pl. This document explains how to use the script to restore a DB2 database.

Step 1: Download and Configure the Script

  1. Click here to download the script. Save it into the home directory of the DB2 instance owner (or any other appropriate directory).
  2. Open the script in a text editor.
  3. Find the section of the script labelled CONFIGURATION CONSTANTS.
  4. Change the value of $DB to the database you want to restore. This can be an existing database or a new database.
  5. Change the value of $SOURCE to the name of the database that was backed up.
  6. Change the value of $BACKUP_DIR to the directory where the backup file is located.
  7. Change $BACKUP_TIME to the time stamp of the backup you wish to restore. Use the format YYYYMMDDHHMMSS. You can cut and paste this value from the name of the backup file. Here's an example of a backup file with the time stamp in large text.
    TEST_SML.0.ldasdb_l.NODE0000.CATN0000.20030404155017.001
  8. Change the value of $APPLY_LOGS to 1 if you want to reapply the transactions that occurred after the backup. Change the value to 0 if you want to restore the database to state of the last backup and then stop.
  9. Change the permissions on the script so that the database instance user has read, write, and execute permissions.
    chmod 777 dbRestore.pl

Step 2: Run It

  1. Open a command shell window.
  2. Log in as the database instance user. For Metaserver, log in as LDASDB.
  3. Run the script using the following command. You may need to include the path to the script.
    perl dbRestore.pl

For more information, see the following:

  1. Performing a Database Backup, Restore, and Rollforward
  2. IBM DB2 Command Reference
  3. Quick Beginnings for DB2 Extended Enterprise Edition for UNIX


$Id: restoring_a_database.html,v 1.8 2003/11/21 16:34:32 dsmackin Exp $
Check this page for dead links, sloppy HTML, or a bad style sheet; or strip it for printing.
Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.