linux 启动监听报 TNS-12545、TNS-12560、TNS-00515问题处理办法

启动监听时报错如下:

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

造成原因:我在启动oracle服务和监听时,服务可以正常启动,但启动监听时报上述错误,经过自己和上网排查发现造成这种情况的原因一般有两个,第一就是修改了虚拟机的名称,第二就是虚拟机的IP地址改变了。

解决办法:因只修改了主机名或IP地址并没有修改hosts和listener.ora文件,因此只需要将host和listener.ora里的虚拟机名称和IP改成自己环境实际内容即可

1、查看主机名

[root@mh orcl]# hostname
mh

2、查看IP地址

[root@mh orcl]# ifconfig
ens33: flags=4163  mtu 1500
        inet 192.168.140.126  netmask 255.255.255.0  broadcast 192.168.140.255
        inet6 fe80::20c:29ff:feed:9646  prefixlen 64  scopeid 0x20
        ether 00:0c:29:ed:96:46  txqueuelen 1000  (Ethernet)
        RX packets 751185  bytes 683561676 (651.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 22574  bytes 3801535 (3.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 

3、修改host文件

[root@mh orcl]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.140.126    mh

4、修改listener.ora文件

[oracle@mh ~]$ cd  /app/oracle/product/11.2.0/dbhome_1/network/admin/

[oracle@mh admin]$ vi listener.ora

# listener.ora Network Configuration File: /app/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

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

 

ADR_BASE_LISTENER = /app/u01/app/oracle
 

5、若tnsnames.ora文件里有host 则也需要修改

[oracle@mh admin]$ vi tnsnames.ora

# tnsnames.ora Network Configuration File: /app/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = mh)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
 

6、重启机器即可

[root@mh ~]# reboot

你可能感兴趣的:(linux,运维,服务器)