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

时间:2025-04-12 13:42:53
$ lsnrctl start
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 26-JUL-2017 09:53:42
Copyright (c) 1991, 2014, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mengqf)(PORT=1521)))
TNS-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 refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
。。。。。。

解决:
因只修改了机器的主机名,但host和文件并没有修改,因此需要修改host和监听
修改host文件
$ vi /etc/hosts
#127.0.0.1   localhost localhost4 localhost4.localdomain4
#::1         localhost localhost6 localhost6.localdomain6
127.0.0.1 localhost mwd
192.168.78.17 meng

修改文件
$ vi /u01/app/oracle/product/12.1/db1/network/admin/
# Network Configuration File: /u01/app/oracle/product/12.1/db1/network/admin/
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = meng)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )
 
重启机器即可
# reboot