Currently we have several databases with a HADR configuration where the primary databases are on a Linux Server “A”, with the standby all on Linux Server “B”. DB2 version is 9.7.
We are attempting to relocate the primary database of one of these databases (with the intent of moving all later) to a new Linux Server “C”. Efforts to find something similar have just brought back results of HADR takeover, that is not what we are aiming to do.
Lets call this database MYDB.
I have taken the steps below, and while HADR will start between the two by issuing the relevant start HADR commands first on the standby then on the primary, issuing ‘db2pd -db MYDB -hadr’ is showing them as disconnected with ‘S0000000.log’ as the log file on the opposite end. The correct log is being displayed locally.
Quiesced the database and then stopped HADR on the primary, confirmed on the secondary there was now a log gap, stopped HADR on the Standby and deactivated.
Took an offline backup on the current primary database and sent that to the new server “C”, where an identical version of DB2 is already set up.
Created a new database ‘MYDB’ and restored from the backup sent over.
Updated the relevant database configurations:
On new server C :
db2 update db cfg for mydb using HADR_LOCAL_HOST C
db2 update db cfg for mydb using HADR_LOCAL_SVC hadr_mydb_c
On the existing standby B:
db2 update db cfg for mydb using HADR_REMOTE_HOST C
db2 update db cfg for mydb using HADR_REMOTE_SVC hadr_mydb_c
db2 update alternate server for database mydb using hostname c port 3700
‘hadr_mydb_c’ has been added to /etc/services on both ‘B’ and ‘C’ with a defined port of 3734
‘C’ has been added to both ‘B’ and ‘C’ hosts files. Log locations ect have been created to
match the existing server ‘A’.
At this stage we have done a db2stop and start on the backup, then when we issue ‘db2 start hadr on db mydb as standby’ we get a confirmation that HADR has started.
On the new primary we issue ‘db2 start hadr on db mydb as primary’ we again get a confirmation that HADR has started.
db2pd shows HADR as active but the databases not connected.
Issuing the following command on the backup instance to see HADR details I can’t see the MYDB database listed along with the other databases.
db2 "SELECT SUBSTR(DB_NAME, 1, 8) AS DBNAME, HADR_ROLE, HADR_STATE,HADR_SYNCMODE, HADR_CONNECT_STATUS,HADR_HEARTBEAT,HADR_TIMEOUT,HADR_LOG_GAP FROM TABLE (SNAP_GET_HADR (CAST (NULL as VARCHAR(128)), 0)) as T"
Luckily reverting the HADR config back to what they were previously we can reconnect HADR between the old primary and backup. Any ideas of how best to proceed?