DB2 DPF command line interface cross machine restore with redirect storage group paths.
Procedure
On Destination:
1. Create a database on destination (Example: Prod database).
2. Generate restore scripts for all the nodes (Example: 4 Nodes here) using below commands.
source database – TEST, source instance – db2part1, source client – hjdb2upg-dpf5, destination client – hjdb2rec_dpf, client – hjdb2rec
[db2part1@hjdb2rec ~]$export DB2NODE=0
[db2part1@hjdb2rec ~]$db2 terminate;
db2 restore db TEST load '/opt/commvault/Base/libDb2Sbt.so' open 2 sessions 'options "CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001"' taken at 20240625135424 ON '/home/db2part1/prod' DBPATH ON '/home/db2part1/prod' into prod redirect generate script db2dpf_redirect_node0_restore.clp
[db2part1@hjdb2rec ~]$ export DB2NODE=1
[db2part1@hjdb2rec ~]$ db2 terminate;
[db2part1@hjdb2rec ~]$
db2 restore db TEST load '/opt/commvault/Base/libDb2Sbt.so' open 2 sessions 'options "CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001"' taken at 20240625135424 into prod redirect generate script db2dpf_redirect_node1_restore.clp
[db2part1@hjdb2rec ~]$ export DB2NODE=2
[db2part1@hjdb2rec ~]$ db2 terminate;
[db2part1@hjdb2rec ~]$
db2 restore db TEST load '/opt/commvault/Base/libDb2Sbt.so' open 2 sessions 'options"CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1, CvDpfClientName =hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001"' taken at 20240625135424 into prod redirect generate script db2dpf_redirect_node2_restore.cl
[db2part1@hjdb2rec ~]$ export DB2NODE=3
[db2part1@hjdb2rec ~]$ db2 terminate;
[db2part1@hjdb2rec ~]$
db2 restore db TEST load '/opt/commvault/Base/libDb2Sbt.so' open 2 sessions 'options "CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001"' taken at 20240625135424 into prod redirect generate script db2dpf_redirect_node3_restore.clp [db2part1@hjdb2rec ~]$ db2 -tf db2dpf_redirect_node0_restore.clp
DB20000I The UPDATE COMMAND OPTIONS command completed successfully.
SET CLIENT ATTACH_MEMBER 0
DB20000I The SET CLIENT command completed successfully.
SET CLIENT CONNECT_MEMBER 0
DB20000I The SET CLIENT command completed successfully.
RESTORE DATABASE TEST LOAD '/opt/commvault/Base/libDb2Sbt.so' OPEN 2 SESSIONS OPTIONS 'CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001' TAKEN AT 20240625135424 ON '/home/db2part1/prod' DBPATH ON '/home/db2part1/prod' INTO PROD REDIRECT WITHOUT PROMPTING
SQL1277W - A redirected restore operation is being performed. During a table space restore, only those table spaces that are being restored can have their paths reconfigured. During a database restore, the storage group, storage paths and the DMS table space containers can be reconfigured. DB20000I - The RESTORE DATABASE command completed successfully.
SET STOGROUP PATHS FOR IBMSTOGROUP ON '/home/db2part1/stg1'
DB20000I The SET STOGROUP PATHS command completed successfully.
RESTORE DATABASE TEST CONTINUE
DB20000I The RESTORE DATABASE command completed successfully.
[db2part1@hjdb2rec ~]$ db2 terminate
DB20000I The TERMINATE command completed successfully.
[db2part1@hjdb2rec ~]$ db2 -tf db2dpf_redirect_node1_restore.clp
DB20000I The UPDATE COMMAND OPTIONS command completed successfully.
SET CLIENT ATTACH_MEMBER 1
DB20000I The SET CLIENT command completed successfully.
SET CLIENT CONNECT_MEMBER 1
DB20000I The SET CLIENT command completed successfully.
RESTORE DATABASE TEST LOAD '/opt/commvault/Base/libDb2Sbt.so' OPEN 2 SESSIONS OPTIONS 'CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001' TAKEN AT 20240625135424 INTO PROD REDIRECT WITHOUT PROMPTING
SQL1277W - A redirected restore operation is being performed. During a table space restore, only those table spaces that are being restored can have their paths reconfigured. During a database restore, the storage group, storage paths and the DMS table space containers can be reconfigured. DB20000I - The RESTORE DATABASE command completed successfully.
DB20000I The RESTORE DATABASE command completed successfully.
RESTORE DATABASE TEST CONTINUE
DB20000I The RESTORE DATABASE command completed successfully.
[db2part1@hjdb2rec ~]$ db2 terminate
DB20000I The TERMINATE command completed successfully.
[db2part1@hjdb2rec ~]$ db2 -tf db2dpf_redirect_node2_restore.clp
DB20000I The UPDATE COMMAND OPTIONS command completed successfully.
SET CLIENT ATTACH_MEMBER 2
DB20000I The SET CLIENT command completed successfully.
SET CLIENT CONNECT_MEMBER 2
DB20000I The SET CLIENT command completed successfully.
RESTORE DATABASE TEST LOAD '/opt/commvault/Base/libDb2Sbt.so' OPEN 2 SESSIONS OPTIONS 'CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001' TAKEN AT 20240625135424 INTO PROD REDIRECT WITHOUT PROMPTING
SQL1277W - A redirected restore operation is being performed. During a table space restore, only those table spaces that are being restored can have their paths reconfigured. During a database restore, the storage group, storage paths and the DMS table space containers can be reconfigured. DB20000I - The RESTORE DATABASE command completed successfully.
DB20000I The RESTORE DATABASE command completed successfully.
RESTORE DATABASE TEST CONTINUE
DB20000I The RESTORE DATABASE command completed successfully.
[db2part1@hjdb2rec ~]$ db2 terminate
DB20000I The TERMINATE command completed successfully.
[db2part1@hjdb2rec ~]$ db2 -tf db2dpf_redirect_node3_restore.clp
DB20000I The UPDATE COMMAND OPTIONS command completed successfully.
SET CLIENT ATTACH_MEMBER 3
DB20000I The SET CLIENT command completed successfully.
SET CLIENT CONNECT_MEMBER 3
DB20000I The SET CLIENT command completed successfully.
RESTORE DATABASE TEST LOAD '/opt/commvault/Base/libDb2Sbt.so' OPEN 2 SESSIONS OPTIONS 'CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001' TAKEN AT 20240625135424 INTO PROD REDIRECT WITHOUT PROMPTING
SQL1277W - A redirected restore operation is being performed. During a table space restore, only those table spaces that are being restored can have their paths reconfigured. During a database restore, the storage group, storage paths and the DMS table space containers can be reconfigured. DB20000I - The RESTORE DATABASE command completed successfully.
DB20000I The RESTORE DATABASE command completed successfully.
RESTORE DATABASE TEST CONTINUE
DB20000I The RESTORE DATABASE command completed successfully.[db2part1@hjdb2rec ~]$ db2 "update db cfg for prod using VENDOROPT 'CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001'"
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
[db2part1@hjdb2rec ~]$ db2 "update db cfg for prod using LOGARCHOPT1 'CvSrcDbName=TEST,CvSrcDB2InstanceName=db2part1,CvSrcClientName=hjdb2upg-dpf5,CvDpfClientName=hjdb2rec_dpf,CvClientName=hjdb2rec,CvInstanceName=Instance001'"
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
[db2part1@hjdb2rec ~]$ db2 rollforward db prod to end of logs and complete -
Input database alias = prod
-
Number of members with returned status = 4
| Member ID | RollForward | Next Log | Log Files Processed | Last Committed Transaction |
|---|---|---|---|---|
| 0 | Not pending | S0002379.LOG-S0002379.LOG | 2024-06-25-13.55.03.000000 Local | |
| 1 | Not pending | S0002278.LOG-S0002278.LOG | 2024-06-25-13.55.03.000000 Local | |
| 2 | Not pending | S0002278.LOG-S0002278.LOG | 2024-06-25-13.55.03.000000 Local | |
| 3 | Not pending | S0002278.LOG-S0002278.LOG | 2024-06-25-13.55.03.000000 Local |
DB20000I - The ROLLFORWARD command completed successfully.