Restoring DB2 databases
To restore a DB2® database, open a command-line window.
| Database configuration | Snapshot restore | Restore from IBM Spectrum Protect™ |
|---|---|---|
| DB2 | db2 restore ... use snapshot ... | db2 restore ... or db2 recover ... |
| DB2 in an SAP environment | db2 restore ... use snapshot ... | db2 restore ... or db2 recover ... or backom |
Depending on the options that are specified in the db2 backup ... use snapshot ... command when the snapshot is created, both backup types (snapshot and IBM Spectrum Protect) can be restored. The background copy must be completed before you restore a snapshot backup even if the snapshot backup request completed successfully. When you restore from snapshots, all objects on target volumes that are created in the backup snapshot process are restored.
db2 restore db DBNAME use snapshot taken at TIMESTAMP
Where
TIMESTAMP is a string that represents the time stamp of the backup image and is
optional if there is only one backup image in the source specified. The log files are excluded by
default from the restore unless you specify the logtarget include option. To
restore log files, table spaces, and directories, issue the following command:
db2 restore db DBNAME use snapshot taken at TIMESTAMP logtarget include
In a more complex environment, use the following commands to restore a DB2 multi-partition snapshot:
(catalog node first)
db2_all "<<+0< db2 restore db H80 use snapshot without prompting"
(remaining nodes)
db2_all "<<-0< db2 restore db H80 use snapshot without prompting"
fcmcli -f restore -d <dbname> -B <backupID> -P <partition group name>
If
more than one partition group is used during the backup, the restore operation must be completed for
all partition groups.Restoring DB2 HADR and DB2 standby server environments
Use the fcmcli -f restore_db2standby command to restore a IBM Spectrum Protect Snapshot snapshot backup of a DB2 HADR standby server. Before you restore, ensure that you stop the DB2 HADR function and deactivate the DB2 database. IBM Spectrum Protect Snapshot stops the DB2 manager before the restore operation. If the DB2 HADR is still running or the database is still active, IBM Spectrum Protect Snapshot cannot stop the DB2 manager and the restore is not successful.
A restore operation of an offloaded tape backup from IBM Spectrum Protect can be done by running IBM Spectrum Protect backup-archive client commands on the DB2 HADR standby server. A proxy node setup can be used.
IBM Spectrum Protect Snapshot maintains a backup ID that can uniquely identify any snapshot backup. Backup-archive client backups are not associated with backup IDs. Therefore, there is no correlation between a snapshot backup and its corresponding IBM Spectrum Protect backup, other than the time when either backup was created. In configurations where the offloaded IBM Spectrum Protect backup is scheduled at a different time from the snapshot backup, a time correlation can be difficult to achieve.