【HADR】How to reestablish HADR from scratch after a failure on Standby

转载 http://www-01.ibm.com/support/docview.wss?uid=swg21514783

Cause 
Have a HADR pair with Primary online but a failure on the Standby makes it necessary to reestablish the HADR pair again
  Answer 
This note intends to serve as a quick guide to reestablish HADR, please follow the Information Center link below (Initializing high availability disaster recovery HADR) for full documentation.
 
1. ON THE PRIMARY MACHINE:
 
- Break HADR
db2 "STOP HADR ON DB <database>"
 
Please note that this step is not always needed. If there has been a failure on the Standby and the Standby is inactive, the expected situation is that the HADR would be on a "disconnected" state.
This command ensures that the Primary database is on Standard mode and that we do not have any HADR processes running.
Please review the "STOP HADR command" link below for reference and check its behaviour depending on the state of the server.
 
- Take a new backup image
db2 "backup database <database> ONLINE to <path>"
 
Please note that on the backup and restore commands detailed here and on step 2. we are putting the simplest command. Backup/ Restore can be done using TSM, path could be a NFS exported drive so that ftp is not needed on step 2. Split mirror is also a valid approach for backup.
 
2. ON THE STANDBY MACHINE:
 
- FTP the backup image (from the primary machine) to the STANDBY MACHINE
 
- db2 "restore database <database> from <path>"
 
- Set up HADR cfg parameters on standby database
 
db2 update db cfg for <database> using HADR_LOCAL_HOST <local host>
db2 update db cfg for <database> using HADR_LOCAL_SVC <local port>
db2 update db cfg for <database> using HADR_REMOTE_HOST <remote host>
db2 update db cfg for <database> using HADR_REMOTE_SVC <remote port>
db2 update db cfg for <database> using HADR_REMOTE_INST <remote instance>
 
- Start up HADR on standby server
db2 start hadr on database <database> as standby
 
3. ON THE PRIMARY MACHINE:
 
- Start up HADR on the primary server
db2 start hadr on database <database> as primary
 
- Verify HADR is up and running
db2pd -db <database> -hadr

原文地址:https://www.cnblogs.com/DBA-Ivan/p/4234610.html