Perform a restore to the same instance on a new host computer.
Procedure
The name of the source database is source and that the name of the target database is target.
Note
The backup image timestamp is 14 characters. It has the following format:
yyyymmddhhmmss
-
yyyy - the year
-
mm - the 2 digit month representation (01-12)
-
dd - the day
-
hh - the hour in 24-hour clock format (00-23)
-
mm - the minute (0-59)
-
ss - the second (0-59)
-
On the destination, update the DB2 database configuration parameters LOGARCHOPT1, VENDOROPT. Set the CvSrcDbName parameter to the source database name.
db2 update db cfg for $[target] using LOGARCHOPT1 "'CvSrcDbName=$[source_database_name],CvClientName=$[client_name],CvSrcClientName=$[source_client_name],CvInstanceName=$[Instance001]'" db2 update db cfg for $[target] using VENDOROPT "'CvSrcDbName=$[source_database_name],CvClientName=$[client_name],CvSrcClientName=$[source_client_name],CvInstanceName=$[Instance001]'"
-
At the Command Prompt, type the following command, substituting the backup_image_timestamp parameter.
For non-automatic storage database:
db2 restore db $[source] load $[/opt/commvault/Base/libDb2Sbt.so] taken at $[backup_image_timestamp] into $[target] WITHOUT PROMPTING
For an automatic storage database:
db2 restore db $[source] load $[/opt/commvault/Base/libDb2Sbt.so] taken at $[backup_image_timestamp] on $[Database-Storage-Path-Location] into $[target] WITHOUT PROMPTING
The Database-Storage-Path-Location parameter redefines the storage paths that you associate with an automatic storage database.
The following rules apply to the parameter:
-
You must specify an absolute path name.
-
The path that you specify must locally exist.
-
You can specify multiply path names. Separate each path name with a comma.
The existing storage paths that are defined in the backup image are no longer used. Automatic storage tablespaces are automatically redirected to the new paths.
If you do not specify the Database-Storage-Path-Location parameter for an automatic storage database, then the storage paths are the ones that you defined in the backup image.
-
-
Set the tablespace containers for non-automatic tablespaces.
Note
The file path is the place where the tablespace data is restored. It must be an absolute file path or relative to the database directory. The maximum file path is 254 characters.
db2 set $[tablespace] containers for $[tablespace_id] using $[file_path] $[number_of_pages]
Example
db2 set $[tablespace] containers for $[3] using file '$[E:\DB2_0 3\NODE0000\DBNOAU2\userspace2_01.dbf]' $[2000] -
Set the storage group paths for the automatic storage table spaces:
db2 set stogroup paths for $[storage_group_1] on $['path_1', 'path_2'] db2 set stogroup paths for $[storage_group_2] on $['path_3', 'path_4']
-
Run the following command to continue the restore operation.
db2 restore db $[source] CONTINUE -
On the destination, update the DB2 database configuration parameters LOGARCHOPT1, VENDOROPT because the source database overwrites these parameters after a restore. Set the CvSrcDbName parameter to the source database name.
db2 update db cfg for $[target] using LOGARCHOPT1 "'CvSrcDbName=$[source_database_name],CvClientName=$[client_name],CvSrcClientName=$[source_client_name],CvInstanceName=$[Instance001]'"
db2 update db cfg for $[target] using VENDOROPT "'CvSrcDbName=$[source_database_name],CvClientName=$[client_name],CvSrcClientName=$[source_client_name],CvInstanceName=$[Instance001]'"
-
Roll forward the DB2 database.
db2 rollforward db $[target] to end of logs and stop -
The destination is configured for a cross machine restore. You must update the destination configuration to remove the cross-machine restore parameters (CvSrcDbName, CvSrcInstanceName, and CvClientName).