When you perform a redirected restore operation, you need to specify
the locations of physical containers stored in the backup image and provide
the complete set of containers for each table space that will be altered.
Use the following procedure to generate a redirected restore script based
on an existing backup image, modify the generated script, then run the script
to perform the redirected restore.
About this task
- If the database exists, you must be able to connect to it in order to
generate the script. Therefore, if the database requires an upgrade or crash
recovery, this must be done before you attempt to generate a redirected restore
script.
- If you are working in a partitioned database environment, and the target
database does not exist, you cannot run the command to generate the redirected
restore script concurrently on all database partitions. Instead, the command
to generate the redirected restore script must be run one database partition
at a time, starting from the catalog partition.
Alternatively, you can
first create a dummy database with the same name as your target database.
After the dummy database has been created, you can then generate the redirected
restore script concurrently on all database partitions.
- Even if you specify the REPLACE EXISTING option when you issue the RESTORE
command to generate the script, the REPLACE EXISTING option will appear in
the script commented out.
- For security reasons, your password will not appear in the generated script.
You need to fill in the password manually.
- You cannot generate a script for redirected restore using the Restore
Wizard in the Control Center.
To perform a redirected restore using a script:
Before you begin
You can perform a redirected restore only if the database has been
previously backed up using the DB2® backup utility.
Procedure
- Use the restore utility to generate a redirected restore script.
The restore utility can be invoked through the command line processor (CLP)
or the db2Restore application programming interface (API). The following
is an example of the RESTORE DATABASE command with the REDIRECT option and
the GENERATE SCRIPT option:
db2 restore db test from /home/jseifert/backups taken at 20050304090733
redirect generate script test_node0000.clp
This creates a redirected restore script on the client called test_node0000.clp.
- Open the redirected restore script in a text editor to make any
modifications that are required. You can modify:
- Restore options
- Automatic storage paths
- Container layout and paths
- Run the modified redirected restore script. For example:
db2 -tvf test_node0000.clp