Loading...

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

Perform a restore to a different instance on a new host.

Procedure

The name of the source 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 client is client2, the name of the destination instance is db2inst4, and the name of the destination database is target. The Commvault instance name (in a multi-instance environment) is Instance001.

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 CvSrcClientName option to the source client name and the CvSrcDB2InstanceName option to the source database name in the VENDOROPT parameter on the destination database.

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

    Example

    db2 update db cfg for target using VENDOROPT "'CvSrcDbName=Test_database,CvSrcDB2InstanceName=test_instance,CvSrcClientName=test_client,
    CvClientName=client1,CvInstanceName=Instance001'"

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

    For 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 REDIRECT

    Example

    db2 restore db source load /opt/commvault/Base/libDb2Sbt.so taken at 201610226100000 on /temp/test into target REDIRECT

    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 non-automatic storage database:

    db2 restore db source load /opt/commvault/Base/libDb2Sbt.so taken at 201610226100000 into target WITHOUT PROMPTING

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

    db2 restore db source continue

  4. 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, the CvSrcClientName parameter to the source client name, and the CvSrcDB2InstanceName parameter to the source instance name in the LOGARCHOPT1 parameter.

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

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

    Example

    db2 update db cfg for target using LOGARCHOPT1 "'CvSrcDbName=Test_database,CvSrcDB2InstanceName=test_instance,CvSrcClientName=test_client,CvClientName=client1, CvInstanceName=Instance001'"

    db2 update db cfg for target using VENDOROPT "'CvSrcDbName=Test_database,CvSrcClientName=test_client,CvSrcDB2InstanceName=test_instance,CvClientName=client1, CvInstanceName=Instance001'"

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

    db2 rollforward db target to end of logs and stop

  6. 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: 4/19/2018 3:06:15 PM