问题描述

$ 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)))
。。。。。。

解决方案

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

修改listener.ora文件
$ vi /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.

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

重启机器即可
# reboot

如果机器里有tnsnames.ora这个文件的HOST也需要修改,但是这个文件建议使用IP地址。

05-11 14:11