Restoring a Database
To make it a little easier to run a DB2 database restore, we created the Perl script
This document explains how to use the script to restore a DB2 database.
Step 1: Download and Configure the Script
- Click here to download the script. Save it into the home directory of the DB2 instance owner
(or any other appropriate directory).
- Open the script in a text editor.
- Find the section of the script labelled CONFIGURATION CONSTANTS.
- Change the value of $DB to the database you want to restore. This can be an existing database
or a new database.
- Change the value of $SOURCE to the name of the database that was backed up.
- Change the value of $BACKUP_DIR to the directory where the backup file is located.
- 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.
- 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.
- 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
- Open a command shell window.
- Log in as the database instance user. For Metaserver, log in as LDASDB.
- Run the script using the following command. You may need to include the path to the
For more information, see the following:
- Performing a Database Backup, Restore, and Rollforward
- IBM DB2 Command Reference
- 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 $