Show pageOld revisionsBacklinksODT exportBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== DB2 High Availability Data Replication - Setup ====== ===== PRIMARY NODE ===== **1. Identify or create database for HADR** <sxh bash> db2 create database <DBNAME> ... or db2sampl </sxh> **2. Configure DB for log archiving** <sxh bash> db2 update db cfg for <DBNAME> using LOGARCHMETH1 LOGRETAIN </sxh> Above command will enable to database for log archiving and keep the logs in the same active log directory. This will also place the db in backup pending state. **3. Configure HADR DB parameters on Primary database** <sxh bash> db2 update db cfg for <DBNAME> using HADR_LOCAL_HOST <IP ADDRESS OF PRIM> db2 update db cfg for <DBNAME> using HADR_LOCAL_SVC <PORT # on PRIM> db2 update db cfg for <DBNAME> using HADR_REMOTE_HOST <IP ADDRESS OF STNDBY> db2 update db cfg for <DBNAME> using HADR_REMOTE_SVC <PORT # on STNDBY> db2 update db cfg for <DBNAME> using HADR_REMOTE_INST <INSTNAME OF STNDBY> db2 update db cfg for <DBNAME> using LOGINDEXBUILD ON </sxh> **4. Take an offline backup to be used for HADR configuration** <sxh bash> db2 "backup database <DBNAME> [to '/path/to/backup'|use TSM]" </sxh> **5. Transfer the backup image to the Standby node or grant access to Standby TSM node** ===== STANDBY NODE ===== Ensure both the servers are on the same db2level so that a mismatch situation does not occur. Run "db2level" command on both the servers to check whether they are on the same DB2 Version and Fix Pack. **6. Restore the database from backup image (disk or TSM)** <sxh bash> db2 "restore database DBNAME [from '/path/to/backup'|use TSM] taken at <TIMESTAMP>" </sxh> **7. Configure HADR DB parameters on Standby DB** <sxh bash> db2 update db cfg for <DBNAME> using HADR_LOCAL_HOST <IP ADDRESS ON STANDBY> db2 update db cfg for <DBNAME> using HADR_LOCAL_SVC <PORT #/SERVICE NAME ON STANDBY> db2 update db cfg for <DBNAME> using HADR_REMOTE_HOST <IP ADDRESS ON PRIM> db2 update db cfg for <DBNAME> using HADR_REMOTE_SVC <PORT # ON PRIM> db2 update db cfg for <DBNAME> using HADR_REMOTE_INST <INSTNAME ON PRIM> </sxh> **8. Start HADR on Standby DB** <sxh bash> db2 start hadr on database <DBNAME> as standby </sxh> ===== PRIMARY NODE ===== **9. Start HADR on Primary DB** <sxh bash> db2 start hadr on database <DBNAME> as primary </sxh> **10. Check HADR is up and running** <sxh bash> db2pd -db <DBNAME> -hadr </sxh> <WRAP center round important 100%> Hostname of the HADR pair cannot be the same on both the servers. The instance name and the underlying userid on UNIX systems can be different. Make sure to update the correct name of the instance for the db cfg parameter HADR_REMOTE_INST to the correct value. </WRAP> db2_hadr_setup.txt Last modified: 2019/10/18 20:04by 127.0.0.1