Loading...

DB2 Command Line Example: Restoring to a Different Instance on the Source Host

Perform a restore to a different instance on the source host.

Procedure

The name of the client is Client1, the name of the source DB2 instance is db2inst3, the name of the source database is source, the name of the destination DB2 instance is db2inst4, and the name of the destination database is target. In a Commvault multi-instance environment, the default instance is Instance001. If you created more than one Commvault instance and you want to use a non-default instance, you must set the instance parameter to the non-default instance name (for example, Instance002).

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)
  1. Set the CvSrcDB2InstanceName option to the source database name in the VENDOROPT parameter.

    db2 update db cfg for target using VENDOROPT "'CvSrcDB2InstanceName=source_instance_name,CvSrcDB2DbName=source_database_name,CvClientName=client_name, CvInstanceName=Instance001'"

  2. At the Command Prompt, run the following restore command:

    db2 restore db source load /opt/commvault/Base/libDb2Sbt.so taken at <backup_image_timestamp> on <database-storage-path-location> into target REDIRECT

  3. 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 length 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

  4. Run the following command to continue the restore operation:

    db2 restore db source CONTINUE

  5. 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 and the CvSrcDB2InstanceName parameter to the source DB2 instance name in the LOGARCHOPT1 parameter.

    db2 update db cfg for target using LOGARCHOPT1 "'CvSrcDbName=source_database_name,CvSrcDB2InstanceName=source_instance_name,CvClientName=source_client_name, CvInstanceName=Instance001'"

  6. Run the following command to roll forward the DB2 database:

    db2 rollforward db target to end of logs and stop

  7. 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).

Last modified: 7/10/2018 2:50:54 PM