温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

lisenter更改主机名之后监听不到服务

发布时间:2020-05-27 19:21:36 来源:网络 阅读:457 作者:湛康颖 栏目:关系型数据库

lisenter更改主机名之后监听不到服务


环境描述,linux redhat5.4 + oracle 11.2.0.1

主机名:zky.zhan

主机ip:192.168.214.10

实例SID:zky
                

问题展现

            如果将listenter.ora中监听地址(HOST = zky.zhan参数更改为监听主机网络地址(HOST = 192.168.214.10)后。发现服务监听不到服务器,一直显示no server ,通过网络服务也不能登录到数据库。


查看tnsname.ora参数

[oracle@zky /]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ZKY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.214.10)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = zky)
    )
  )


查看listener.ora参数

我们将默认的zky.zhan修改为ip地址

[oracle@zky /]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER1 = ON

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
#    (ADDRESS = (PROTOCOL = TCP)(HOST = zky.zhan)(PORT = 1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.214.10)(PORT = 1521))

    )
  )

ADR_BASE_LISTENER = /u01/app/oracle


启动监听

发现The listener supports no services,一直监听不到服务

[oracle@zky /]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-APR-2016 05:34:11

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.2.0/grid/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/zky/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.214.10)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.214.10)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                24-APR-2016 05:34:11
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/zky/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.214.10)(PORT=1521)))
The listener supports no services
The command completed successfully


数据库登录也显示无监听

[oracle@zky /]$ sqlplus system/oracle_4U@zky

SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 24 05:37:17 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor



解决方法
        在纠结多日之后发现当使用ping主机名zky.zhan时发现默认解析为127.0.0.1。于是在试探的状态下将本地解析127.0.0.1修改为192.168.214.10后发现可以正常使用。


更改host

[root@zky /]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1              zky.zhan zky localhost.localdomain localhost
#::1            localhost6.localdomain6 localhost6

192.168.214.10 zky.zhan zky localhost.localdomain localhost


重启监听后服务自己监听到了

[oracle@zky /]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-APR-2016 05:43:40

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.214.10)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                24-APR-2016 05:34:11
Uptime                    0 days 0 hr. 9 min. 29 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/zky/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.214.10)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "zky" has 1 instance(s).
  Instance "zky", status READY, has 1 handler(s) for this service...
Service "zkyXDB" has 1 instance(s).
  Instance "zky", status READY, has 1 handler(s) for this service...
The command completed successfully


登录数据库成功

[oracle@zky /]$ sqlplus system/oracle_4U@zky

SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 24 05:44:59 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      zky
db_unique_name                       string      zky
global_names                         boolean     FALSE
instance_name                        string      zky
lock_name_space                      string
log_file_name_convert                string
service_names                        string      zky




向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI