TNS-12545: Connect failed because target host or object does not exist

TNS-12545: Connect failed because target host or object does not exist

Scenario: Change the Linux host name, restart the machine, and start listening for errors
$ lsnrctl start
LSNRCTL for Linux: Version 12.1.0.2.0-production on 26-jul-2017 09:53:42
Copyright (c) 1991, 2014,
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP))(PORT=1521)))
nss-12545: Connect failed because target host or object does not exist
tns-12560: TNS:protocol adapter error
tns-00515: Connect failed because target host or object does not exist
Linux error: 111: Connection container to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
……

solution:
because only the hostname of the machine is changed, but the host and listlisteners. Ora files are not changed. Ora
modify the host file
$vi /etc/hosts
#127.0.0.1 localhost localhost4 localhost4. Localdomain4
#::1 localhost localhost.localdomain Localhost6 localhost6. Localdomain6
127.0.0.1 localhost MWDS
192.168.78.17 meng

modify the listener.
$vi ora file/u01/app/oracle/product/12.1/db1/network/admin/listener. Ora.
# listener ora Network Configuration File:/u01/app/oracle/product/12.1/db1/network/admin/listener. Ora
# Generated by oracle configuration tools.

the listener =
(DESCRIPTION_LIST =
(the DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = meng)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

restart the machine
# reboot

The HOST for tnsnames.ora on the machine also needs to be changed, but the IP address is recommended for this file.

Read More: