Troubleshooting
Problem
lssam is showing the HADR database resource in an "Unknown" state on both servers even though the HADR pair are peer connected according to the db2pd command.
Symptom
The 'hadr_monitor.ksh' script always exits with a return code of 0'
Cause
The 'hadr_monitor.ksh' script uses the "db2pd.exe" binary to query the HADR state and role. But the db2pd.exe command could not be found when there is an attempt to execute it within the hadr_monitor.ksh script.
Environment
DB2 HADR on Windows, being automated by TSAMP using the DB2 automation scripts
Diagnosing The Problem
Use the syslog to verify the return code and messages from the hadr_monitor.ksh script, else run the hadr_monitor.ksh script (with required args) from the shell command prompt and immediately follow with the command 'echo $?'.
Resolving The Problem
The PATH statement at the top of the script needs to be modified to point to the location of the DB2 install if it is not the default for a Windows deployment :
DEFAULT:
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/sbin/rsct/bin:"/dev/fs/C/Program Files/IBM/SQLLIB/BIN"
If DB2 is installed on D: drive for example :
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/sbin/rsct/bin:"/dev/fs/D/IBM/SQLLIB/BIN"
The PATH statement should be updated in all the DB2 automation scripts, not just the *_monitor.ksh, and on both nodes.
Additionally, if the HADR syncmode is *not* "Sync", then the "hadr_monitor.ksh" script will need to be modified as follows:
DEFAULT:
db2pd.exe -hadr -db ${DB2HADRDBNAME?} \
| grep ${grepFlags?} "Sync " \
| grep "[a-zA-Z]" \
| awk '{print $1 "\n" $2}' > $temp_snap
If syncmode is "Nearsync" :
db2pd.exe -hadr -db ${DB2HADRDBNAME?} \
| grep ${grepFlags?} "Nearsync " \
| grep "[a-zA-Z]" \
| awk '{print $1 "\n" $2}' > $temp_snap
Was this topic helpful?
Document Information
Modified date:
24 June 2019
UID
swg21572385