Release Notes
Abstract
IBM Business Automation Workflow (BAW) Db2 HADR pattern V18.0.0.2 deployment succeeds, however, HADR setup is not correct.
When db2pd -database cpedb -hadr command is run on the primary Db2 server node, the HADR_STATE is DISCONNECTED for CPEDB.
$ db2pd -database cpedb -hadr
HADR_CONNECT_STATUS = DISCONNECTED
Also, lssam command does not show HADR status of CPEDB.
$lssam
Online IBM.ResourceGroup:db2_db2inst1_db2inst1_CPEDB-rg Request=Lock Nominal=Online
'- Online IBM.Application:db2_db2inst1_db2inst1_CPEDB-rs Control=SuspendedPropagated
|- Online IBM.Application:db2_db2inst1_db2inst1_CPEDB-rs:<DB2_Primary_host_name>
'- Offline IBM.Application:db2_db2inst1_db2inst1_CPEDB-rs:<Db2_Secondary_host_name>
Content
Follow these steps to setup HADR for CPEDB and get the databases in sync:
1. On the Db2 primary node, do a complete backup of the database, online.
mkdir /tmp/cpedb (Run this command as db2inst1)
db2 backup database cpedb online to /tmp/cpedb/ (Run this command as db2inst1)
For example:
2. On the Standby Db2 server, copy the backup from Db2 primary to Db2 standby by using following commands:
- mkdir /tmp/cpedb/ (Run this command as db2inst1)
- chmod 755 /tmp/cpedb/ (Run this command as db2inst1)
- scp db2inst1@<Db2 primary IP>:/tmp/cpedb/<backup_file_name> /tmp/cpedb/. (Run this command as db2inst1)
- chmod 755 <name of the backup file>
3. On the Standby Db2 server, drop cpedb database by using the following command:
db2 drop db cpedb (Run this command as db2inst1)
4. On the Standby Db2 server, restore the backed-up database on the standby server by using following sequence of commands (do not roll-forward it):
db2 "restore database cpedb from /tmp/cpedb dbpath on /db2data into cpedb redirect generate script restore_cpedb.sql" (Run this command as db2inst1)
This command creates a restore_cpedb.sql script.
5. On the Standby Db2 server, this script requires following folders to be created on the standby node. Create the folders by using the following command:
(Run these commands as db2inst1)
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/TOSSA/indexfs2
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/TOSSA/indexfs1
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/TOSSA/datafs1
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/TOSSA/datafs2
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/TOSSA/datafs3
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/DOSSA/lobfs1
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/DOSSA/indexfs1
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/DOSSA/indexfs12
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/DOSSA/indexfs2
- mkdir -p /db2data/db2inst1/NODE0000/SQL00002/LOGSTREAM0000/
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/TOSSA/lobfs1
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/DOSSA/datafs1
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/DOSSA/datafs2
- mkdir -p /db2data/db2inst1/NODE0000/CPEDB/DOSSA/datafs3
6. On the Standby Db2 server, restore the database by using the following command:
db2 -tvf restore_cpedb.sql (Run this command as db2inst1)
7. On primary and standby nodes, stop the firewall by using following command:
For example, on a Linux system:
systemctl stop iptables (Run this command as root)
8. On the primary node, set the HADR parameters as follows:
db2 update db cfg for cpedb using HADR_LOCAL_HOST <Local_host_IP> HADR_LOCAL_SVC 60002 HADR_REMOTE_HOST <Remote_host_IP> HADR_REMOTE_SVC 60002 HADR_REMOTE_INST db2inst1 HADR_TIMEOUT 300 HADR_SYNCMODE nearsync (Run this command as db2inst1)
9. On the Standby Db2 server, set the HADR parameters as follows:
db2 update db cfg for cpedb using HADR_LOCAL_HOST <Local_host_IP> HADR_LOCAL_SVC 60002 HADR_REMOTE_HOST <Remote_host_IP> HADR_REMOTE_SVC 60002 HADR_REMOTE_INST db2inst1 HADR_TIMEOUT 300 HADR_SYNCMODE nearsync (Run this command as db2inst1)
10. Start HADR on the Standby Db2 server by using the following command:
db2 start hadr on database cpedb as standby (Run this command as db2inst1)
11. Start HADR on the primary node by using the following command:
db2 start hadr on database cpedb as primary (Run this command as db2inst1)
[Optional] If lssam or db2pd -database cpedb -hadr output is still incorrect (DISCONNECTED) then stop HADR on CPEDB by using the following commands:
[Optional] – On the Standby Db2 server, stop cpedb hadr by using the following command:
db2 stop hadr on database cpedb
[Optional] – On the primary Db2 server, stop cpedb hadr by using the following command:
db2 stop hadr on database cpedb
Start HADR on standby and primary Db2 servers by using commands in the above-mentioned steps.
12. Check the HADR status of cpedb. Ensure that the status is “CONNECTED” on both, the standby and the primary Db2 servers.
$ db2pd -database cpedb -hadr
HADR_CONNECT_STATUS = CONNECTED
Was this topic helpful?
Document Information
Modified date:
06 May 2020
UID
ibm11119705