You can restore any database or table space backup image to an existing
database. For a database-level restore, the backup image can differ from
the existing database in its alias name, its database name, or its database
seed. For a table-space level restore, you can restore a table space into
an existing database only if the table space currently exists, and if it
is the same table space; "same" means that the table space was not dropped
and then recreated between the backup and the restore operation. The database
on disk and in the backup image must be the same.
A database seed is a unique identifier for a database that does
not change during the life of the database. The seed is assigned by the database
manager when the database is created. DB2® always uses the seed from the backup
image.
When restoring to an existing database, the restore utility:
- Deletes table, index, and long field data from the existing database,
and replaces it with data from the backup image.
- Replaces table entries for each table space being restored.
- Retains the recovery history file, unless it is damaged or has no entries.
If the recovery history file is damaged or contains no entries, the database
manager copies the file from the backup image. If you want to replace the
recovery history file you can issue the RESTORE command with the REPLACE
HISTORY FILE option.
- Retains the authentication type for the existing database.
- Retains the database directories for the existing database. The directories
define where the database resides, and how it is cataloged.
- Compares the database seeds. If the seeds are different:
- Deletes the logs associated with the existing database.
- Copies the database configuration file from the backup image.
- Sets NEWLOGPATH to the value of the logpath database
configuration parameter if NEWLOGPATH was specified on the RESTORE DATABASE
command.
If the database seeds are the same: - Deletes all log files if the image is for a non-recoverable
database.
- Deletes empty log files if the image is for a recoverable
database. Non-empty log files are not affected.
- Retains the current database configuration file.
- Sets NEWLOGPATH to the value of the logpath database
configuration parameter if NEWLOGPATH was specified on the RESTORE DATABASE
command; otherwise, copies the current log path to the database configuration
file. Validates the log path: If the path cannot be used by the database,
changes the database configuration to use the default log path.