Search In The Blog

Wednesday 20 June 2018

TNS-12564: TNS:connection refused


TNS-12564: TNS:connection refused


We are using 12c six node primary. For this we have configured three node standby database. We validate the things from the configuration perspective and we are good.

Post this we configured data guard broker for the same and post data guard configiguration below error is frequently reporting to the alert of standby database.


standby alert log
=============
Fatal NI connect error 12521, connecting to:
 (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XX.XXX.XXX.XX1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=XX.XXX.XXX.XX2)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=XX.XXX.XXX.XX3)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=XX.XXX.XXX.XX4)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=XX.XXX.XXX.XX5)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=XX.XXX.XXX.XX6)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=dba_DGB)(INSTANCE_NAME=dba4)(CID=(PROGRAM=oracle)(HOST=ctsttbadm03.cts.com)(USER=orahcm))))
  VERSION INFORMATION:
        TNS for Linux: Version 12.1.0.2.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 12.1.0.2.0 - Production
  Time: 19-FEB-2018 22:02:26
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12564

TNS-12564: TNS:connection refused



Cause :


This is caused by incorrect DGConnectIdentifier property in the broker's configuration (DGMGRL)

When Primary is a RAC database, the Standby Single Instance's DGConnectIdentifier property in the broker/dgmrl should be set to the SCAN name of the cluster database.
In this scenario, the DGConnectIdentifier was configured to use the cluster's VIP address, caused the connection problem from the Standby to the Primary.


Solution:

Check the database configuration in the broker using DGMGRL, as in example below:
For the Standby Database - "dba", it shows it as:
DGMGRL> show database verbose 'dba';

Properties:
DGConnectIdentifier = ' DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dba)(SERVER=DEDICATED)))'
  

For the Primary Cluster Database - "dbaa", it shows it as:
DGMGRL> show database verbose 'dbaa';

Properties:
DGConnectIdentifier  = ' DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<vip hostname>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dbaa)(SERVER=DEDICATED)))'
  


The ALERT LOG from the STANDBY continuously reports TNS-12521 while connecting to the (HOST=<vip hostname>)
Fatal NI connect error 12521, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<vip hostname>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dbaa_DGB)(INSTANCE_NAME=dba2)(SERVER=DEDICATED)(CID=(PROGRAM=oracle)(HOST=<hostname>)(USER=oracle))))
  

It should not use the VIP address 'vip hostname' as DGConnectIdentifier but the SCAN address for the PRIMARY cluster database instead.

Fix the DGConnectIdentifier property in the Broker configuration to use SCAN name of the cluster database
for example:
DGMGRL>edit database dbaa set property DGConnectIdentifier = '(DESCRIPTION = (LOAD_BALANCE = ON)(ADDRESS = (PROTOCOL = TCP)(HOST = <scan host address>)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = dbaa)))'