SQL1768N Unable to start HADR. Reason code = "5"

While initializing DB2 HADR you might receive error  SQL1768N  Unable to start HADR. Reason code = "5".  There are multiple scenario in which you might receive SQL1768N  Reason Code 5. In this blog we will go through scenarios in which you might get this error and solution to fix it. IBM documentation list below explanation for this error:


SQL1768N Unable to start HADR. Reason code = "<reason-code>".

Explanation:

The explanation corresponding to the reason code is:

5         Invalid service name for the hadr_local_svc configuration parameter.

User response:

The user response corresponding to the reason code is:

5      Ensure that the hadr_local_svc configuration parameter is set to a valid service name. For Unix platforms, edit the          /etc/services file. For Windows, edit %SystemRoot%\system32\drivers\etc\services. Alternatively, a literal port number can be specified for this parameter.

Even though in above explanation its mentioned issue is with valid service name configured for hadr_local_svc parameter, its not the issue always. In below scenarios you can face SQL1768N  Unable to start HADR. Reason code = "5" issue.

Scenario 1: Invalid Service Name

Service name specified in hadr_local_svc parameter is missing in service file i.e. /etc/services for Linux/Unix server or %SystemRoot%\system32\drivers\etc\services for windows server. 

In db2diag.log you will see below error message

PID     : 2035                 TID : 140550535636736 PROC : db2sysc 0
INSTANCE: db2i1                NODE : 000            DB   : TESTDB
APPHDL  : 0-140                APPID: *LOCAL.db2i1.210110182356
AUTHID  : DB2I1                HOSTNAME: db2test1
EDUID   : 226                  EDUNAME: db2agent (TESTDB) 0
FUNCTION: DB2 UDB, High Availability Disaster Recovery, hdrGetPortByName, probe:1100
MESSAGE : ZRC=0x070F00B8=118423736=SQLO_NOT_FOUND
          "Environment/registry variable was not found."
DATA #1 : <preformatted>
Invalid input for port: DB2I1_HADR_1

Solution: Update service file with service name specified in hadr_local_svc parameter.

Scenario 2: Invalid Port Type

Service name mentioned in service file is of invalid port type. In below image even though service name is present in service file but since port type is invalid we will get this error SQL1768N  Unable to start HADR. Reason code = "5"

Invalid Port Type in /etc/service file




In db2diag.log you will see below error message

PID     : 2035                 TID : 140550535636736 PROC : db2sysc 0
INSTANCE: db2i1                NODE : 000            DB   : TESTDB
APPHDL  : 0-141                APPID: *LOCAL.db2i1.210110182612
AUTHID  : DB2I1                HOSTNAME: db2test1
EDUID   : 226                  EDUNAME: db2agent (TESTDB) 0
FUNCTION: DB2 UDB, High Availability Disaster Recovery, hdrGetPortByName, probe:1100
MESSAGE : ZRC=0x070F00B8=118423736=SQLO_NOT_FOUND
          "Environment/registry variable was not found."
DATA #1 : <preformatted>
Invalid input for port: DB2I1_HADR_1


Solution: Update service file with correct port type.

Scenario 3: Use of UDP port

Service name mentioned in service file is of udp port we will get error SQL1768N  Reason Code 5

UDP port



In db2diag.log you will see below error message

PID     : 2035                 TID : 140550602745600 PROC : db2sysc 0
INSTANCE: db2i1                NODE : 000            DB   : TESTDB
APPHDL  : 0-143                APPID: *LOCAL.db2i1.210110183021
AUTHID  : DB2I1                HOSTNAME: db2test1
EDUID   : 21                   EDUNAME: db2agent (TESTDB) 0
FUNCTION: DB2 UDB, High Availability Disaster Recovery, hdrGetPortByName, probe:1100
MESSAGE : ZRC=0x070F00B8=118423736=SQLO_NOT_FOUND
          "Environment/registry variable was not found."
DATA #1 : <preformatted>
Invalid input for port: DB2I1_HADR_1



Solution: Update service file with port type as tcp instead of udp.

Scenario 4: Use of port used by other service

Port number specified for hadr_local_svc service name in service file is already use by some other application/process/service we will get this error

In db2diag.log you will see below error message

PID     : 2035                 TID : 140550497888000 PROC : db2sysc 0
INSTANCE: db2i1                NODE : 000            DB   : TESTDB
HOSTNAME: db2test1
EDUID   : 248                  EDUNAME: db2hadrp.0.1 (TESTDB) 0
FUNCTION: DB2 UDB, High Availability Disaster Recovery, hdrSetupListenerSocket, probe:22030
MESSAGE : ZRC=0x840F0001=-2079391743=SQLO_ACCD "Access Denied"
          DIA8701C Access denied for resource "", operating system return code
          was "".
DATA #1 : <preformatted>
Failed to setup listener socket on address=192.168.0.201:22

PID     : 2035                 TID : 140550497888000 PROC : db2sysc 0
INSTANCE: db2i1                NODE : 000            DB   : TESTDB
HOSTNAME: db2test1
EDUID   : 248                  EDUNAME: db2hadrp.0.1 (TESTDB) 0
FUNCTION: DB2 UDB, High Availability Disaster Recovery, hdrEdu::hdrEduP, probe:20360
MESSAGE : ZRC=0x87800142=-2021654206=HDR_ZRC_CONFIG_LOCAL_SVC
          "HADR_LOCAL_SVC configuration parameter is an invalid service name"


Solution: Update service file with unique port number which is not used by any other application/process/service.

Scenario 5: Use of port same as SVCENAME or SVCENAME+1

Port number specified for hadr_local_svc service name in service file is same as port number configured for SVCENAME or SVCENAME+1.

E.g If SVCENAME is configured to use TCP port 50000, we cannot use port 50000 and 50001 for hadr_local_svc. 

In db2diag.log you will see below error message

PID     : 2035                 TID : 140550602745600 PROC : db2sysc 0
INSTANCE: db2i1                NODE : 000            DB   : TESTDB
APPHDL  : 0-150                APPID: *LOCAL.db2i1.210110184343
AUTHID  : DB2I1                HOSTNAME: db2test1
EDUID   : 21                   EDUNAME: db2agent (TESTDB) 0
FUNCTION: DB2 UDB, High Availability Disaster Recovery, hdrValidateLocalServiceDbCfg, probe:21210
MESSAGE : ZRC=0x87800142=-2021654206=HDR_ZRC_CONFIG_LOCAL_SVC
          "HADR_LOCAL_SVC configuration parameter is an invalid service name"
DATA #1 : <preformatted>
HADR_LOCAL_SVC cannot be same port as SVCENAME or SVCENAME +1
HADR_LOCAL_SVC DB2I1_HADR_1,  Port # 50001
SVCENAME       db2c_db2i1,  Port # 50000
SVCENAME + 1   50001


Solution: Update service file with unique port number which is not used by any other application/process/service and also its different from SVCENAME and SVCENAME+1.



If you liked this blog and interested in knowing more about DB2, please subscribe by clicking on Subscribe to ChoudharySumit.com by Email.

No comments:

Post a Comment