One of the reasons for getting this error might be that the sqlnet.ora does not contain the proper settings like in this particular case:
[oracle@server admin]$ cat sqlnet.ora
[oracle@server admin]$
As you can see there is nothing set in sqlnet.ora. Therefor when I was trying to reinstate a former PRIMARY as STANDBY, I was seeing in alert log of the reinstated database this:
Fatal NI connect error 12514, connecting to:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxxx)(PORT=1521)))(CONNECT_DATA=(ORACLE_SID=db)(INSTANCE_NAME=db)(CID=(PROGRAM=oracle)(HOST=xxxxxx)(USER=oracle))))
VERSION INFORMATION:
TNS for Linux: Version 19.0.0.0.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 19.0.0.0.0 - Production
Version 19.3.0.0.0
Time: 12-APR-2020 06:49:28
Tracing not turned on.
Tns error struct:
ns main err code: 12564
TNS-12564: TNS:connection refused
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
In order to fix this, I have set this in SQLNET.ORA the following:
NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT, HOSTNAME)
And the reinstate worked like a charm.