ITPub博客

首页 > 数据库 > Oracle > 记一次remote_listener引发的错误

记一次remote_listener引发的错误

原创 Oracle 作者:jason_yehua 时间:2022-11-30 14:02:01 0 删除 编辑

一、客户端操作如下:
        1.客户端连接异常从报错来看似乎是监听的问题
        C:\Documents and Settings\Administrator>sqlplus system/abc123@orcl
        SQL*Plus: Release 10.2.0.1.0 – Production on 星期二 12月 2 13:21:16 2014
        Copyright (c) 1982, 2005,    Oracle   .  All rights reserved.
        ERROR:
        ORA-12545: 因目标主机或对象不存在, 连接失败
        请输入用户名:
        2.tnsping检查连接串配置及服务器监听状态
        C:\Documents and Settings\Administrator>tnsping orcl
        TNS Ping Utility for 32-   bi   t Windows: Version 10.2.0.1.0 – Production on 02-12月-2014 13:22:17
        Copyright (c) 1997, 2005, Oracle.  All rights reserved.
        已使用的参数文件:
        F:\   oracle   \product\10.2.0\db_1\network\admin\sqlnet.ora
        已使用 TNSNAMES 适配器来解析别名
        Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
        (HOST = 192.168.0.94)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0
        .93)(PORT = 1521)) (LOAD_BALANCE = yes)) (CONNECT_DATA = (SERVER = SHARED) (SERV
        ICE_NAME = orcl) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC))))
        OK (30 毫秒)
        从tnsping的测试来看,连接串监听都正常
        tnsnames连接串如下:
        ORCL =
          (DESCRIPTION =
            (ADDRESS_LIST =
              (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.94)(PORT = 1521))
              (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.93)(PORT = 1521))
              (LOAD_BALANCE = yes)
            )
            (CONNECT_DATA =
              (SERVER = SHARED)
              (SERVICE_NAME = orcl)
              (FAILOVER_MODE =
                (TYPE = SELECT)
                (METHOD = BASIC)
              )
            )
          )
        ORCL2 =
          (DESCRIPTION =
            (ADDRESS_LIST =
              (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.93)(PORT = 1521))
            )
            (CONNECT_DATA =
              (SERVER = SHARED)
              (SERVICE_NAME = orcl)
              (INSTANCE_NAME = orcl2)
            )
          )
        ORCL1 =
          (DESCRIPTION =
            (ADDRESS_LIST =
              (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.94)(PORT = 1521))
            )
            (CONNECT_DATA =
              (SERVER = SHARED)
              (SERVICE_NAME = orcl)
              (INSTANCE_NAME = orcl1)
            )
          )
        3.由于是生产库是rac环境的尝试单节点登入
        C:\Documents and Settings\Administrator>sqlplus system/abc123@orcl1
        SQL*Plus: Release 10.2.0.1.0 – Production on 星期二 12月 2 13:26:17 2014
        Copyright (c) 1982, 2005, Oracle.  All rights reserved.
        连接到:
        Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
        With the Partitioning, Real Application Clusters, OLAP, Data Mining
        and Real Application Testing options
        SQL> exit
        从 Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
        With the Partitioning, Real Application Clusters, OLAP, Data Mining
        and Real Application Testing options 断开
        C:\Documents and Settings\Administrator>sqlplus system/abc123@orcl2
        SQL*Plus: Release 10.2.0.1.0 – Production on 星期二 12月 2 13:26:24 2014
        Copyright (c) 1982, 2005, Oracle.  All rights reserved.
        连接到:
        Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
        With the Partitioning, Real Application Clusters, OLAP, Data Mining
        and Real Application Testing options
        从单节点的登入来看配置都正常而且可以正常连接,问题很奇怪为了进一步排查开启开启客户端跟踪
        配置如下:
        在客户端的sqlnet.ora文件中添加如下内容:
        TRACE_LEVEL_CLIENT=16
        TRACE_FILE_CLIENT=CLIENT
        TRACE_TIMESTAMP_CLIENT=ON
        trace_directory_client=D:\oracle\product\10.2.0\db_1\network\ADMIN
        4.重新用客户端登入收集跟踪信息
        跟踪信息如下:
        [02-12月-2014 14:10:32:968] nsmfr: normal exit
        [02-12月-2014 14:10:32:968] nsmfr: entry
        [02-12月-2014 14:10:32:968] nsmfr: 736 bytes at 0xe4b9d8
        [02-12月-2014 14:10:32:968] nsmfr: normal exit
        [02-12月-2014 14:10:32:968] nsclose: normal exit
        [02-12月-2014 14:10:32:968] nscall: connecting…
        [02-12月-2014 14:10:32:968] nsc2addr: entry
        [02-12月-2014 14:10:32:968] nsc2addr: (ADDRESS=(PROTOCOL=tcp)(HOST=hp)(PORT=3554))
        [02-12月-2014 14:10:32:968] nttbnd2addr: entry
        [02-12月-2014 14:10:32:968] snlinGetAddrInfo: entry
        [02-12月-2014 14:10:32:968] snlinGetAddrInfo: Invalid IP address string hp
        [02-12月-2014 14:10:32:968] snlinFreeAddrInfo: entry
        [02-12月-2014 14:10:32:968] snlinFreeAddrInfo: exit
        [02-12月-2014 14:10:32:968] snlinGetAddrInfo: exit
        [02-12月-2014 14:10:32:968] nttbnd2addr: looking up IP addr for host: hp
        [02-12月-2014 14:10:32:968] snlinGetAddrInfo: entry
        [02-12月-2014 14:10:35:218] snlinGetAddrInfo: Name resolution failed for hp
        [02-12月-2014 14:10:35:218] snlinFreeAddrInfo: entry
        [02-12月-2014 14:10:35:218] snlinFreeAddrInfo: exit
        [02-12月-2014 14:10:35:218] snlinGetAddrInfo: exit
        [02-12月-2014 14:10:35:218] nttbnd2addr:  *** hostname lookup failure! ***
        [02-12月-2014 14:10:35:218] nttbnd2addr: exit
        [02-12月-2014 14:10:35:218] nserror: entry
        [02-12月-2014 14:10:35:218] nserror: nsres: id=0, op=77, ns=12545, ns2=12560; nt[0]=515, nt[1]=1001, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
        [02-12月-2014 14:10:35:218] nsc2addr: error exit
        从以上跟踪信息
        [02-12月-2014 14:10:32:968] nsc2addr: (ADDRESS=(PROTOCOL=tcp)(HOST=hp)(PORT=3554))
        [02-12月-2014 14:10:32:968] nttbnd2addr: entry
        [02-12月-2014 14:10:32:968] snlinGetAddrInfo: entry
        [02-12月-2014 14:10:32:968] snlinGetAddrInfo: Invalid IP address string hp
        当我们尝试使用orcl连接串连接是被路由到了HP这个主机,可是tnsnames.ora连接串里面根本没有配置相关的信息,那怎么会呢
        从客户端的配置似乎查不出什么原因
        二、服务器端配置查看
        1.查看生产库的local_listener和remote_listener配置
        SQL> show parameter local
        NAME                                 TYPE        VALUE
        ———————————— ———– ——————————
        local_listener                       string      (address=(protocol=tcp)(host=192.168.0.93)(port=1521))
        SQL> show parameter remote
        NAME                                 TYPE        VALUE
        ———————————— ———– ——————————
        remote_listener                      string      LISTENERS_ORCL
        从配置上来看都没有任何异常
        2.查看生产库的监听状态
        C:\Documents and Settings\Administrator>lsnrctl status
        LSNRCTL for 64-bit Windows: Version 10.2.0.4.0 – Production on 02-12月-2014 14:15:29
        Copyright (c) 1991, 2007, Oracle.  All rights reserved.
        正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
        LISTENER 的 STATUS
        ————————
        别名                      LISTENER
        版本                      TNSLSNR for 64-bit Windows: Version 10.2.0.4.0 – Production
        启动日期                  24-11月-2014 20:52:17
        正常运行时间              7 天 17 小时 23 分 13 秒
        跟踪级别                  off
        安全性                    ON: Local OS Authentication
        SNMP                      OFF
        监听程序参数文件          D:\oracle\product\10g\network\admin\listener.ora
        监听程序日志文件          D:\oracle\product\10g\network\log\listener.log
        监听端点概要…
          (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=svr01)(PORT=1521)))
        服务摘要..
        服务 "+   ASM   " 包含 1 个例程。
          例程 "+   asm   2", 状态 BLOCKED, 包含此服务的 1 个处理程序…
        服务 "+ASM_XPT" 包含 1 个例程。
          例程 "+asm2", 状态 BLOCKED, 包含此服务的 1 个处理程序…
        服务 "orcl" 包含 3 个例程。
          例程 "orcl1", 状态 READY, 包含此服务的 31 个处理程序…
          例程 "orcl2", 状态 READY, 包含此服务的 32 个处理程序…
          例程 "orclstd", 状态 READY, 包含此服务的 2 个处理程序…
        服务 "orcl_XPT" 包含 3 个例程。
          例程 "orcl1", 状态 READY, 包含此服务的 31 个处理程序…
          例程 "orcl2", 状态 READY, 包含此服务的 32 个处理程序…
          例程 "orclstd", 状态 READY, 包含此服务的 2 个处理程序…
        命令执行成功
        从监听来看似乎也看不出什么端倪
        3.生产库尝试用orcl连接串连接
        C:\Documents and Settings\Administrator>sqlplus  system/abc123@orcl
        SQL*Plus: Release 10.2.0.4.0 – Production on 星期二 12月 2 13:45:51 2014
        Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
        连接到:
        Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
        With the Partitioning, OLAP, Data Mining and Real Application Testing options
        SQL> select instance_name from v$instance;
        INSTANCE_NAME
        —————-
        orclstd
        SQL> show parameter remote
        NAME                                 TYPE        VALUE
        ———————————— ———– ——————————
        remote_listener                      string      LISTENERS_ORCL
        C:\Documents and Settings\Administrator>tnsping listeners_orcl
        TNS Ping Utility for 64-bit Windows: Version 10.2.0.4.0 – Production on 02-12月-2014 14:01:53
        Copyright (c) 1997,  2007, Oracle.  All rights reserved.
        已使用的参数文件:
        D:\oracle\product\10g\network\admin\sqlnet.ora
        已使用 TNSNAMES 适配器来解析别名
        Attempting to contact (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = svr02-vip)(PORT = 1521)) (ADDRESS = (
        PROTOCOL = TCP)(HOST = svr01-vip)(PORT = 1521)))
        OK (20 毫秒)
        C:\Documents and Settings\Administrator>sqlplus / as sysdba
        SQL*Plus: Release 10.2.0.4.0 – Production on 星期二 12月 2 14:01:02 2014
        Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
        连接到:
        Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
        With the Partitioning, Real Application Clusters, OLAP, Data Mining
        and Real Application Testing options
        SQL> select instance_name from gv$instance;
        INSTANCE_NAME
        —————-
        orcl2
        orcl1
        从以上的连接来看其实已经很明显了,当时用orcl连接串连接时连接到orclstd,由于orclstd库remote_listener参数所引起,
        orclstd库在远程注册实例状态了,然后路由到备机了,导致生产使用orcl报错。
        注     orclstd这个库是利用生产的rman备份恢复回来的数据库)
        4.查看生产监听状态正式以上判断
        C:\Documents and Settings\Administrator>lsnrctl status
        LSNRCTL for 64-bit Windows: Version 10.2.0.4.0 – Production on 02-12月-2014 14:15:29
        Copyright (c) 1991, 2007, Oracle.  All rights reserved.
        正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
        LISTENER 的 STATUS
        ————————
        别名                      LISTENER
        版本                      TNSLSNR for 64-bit Windows: Version 10.2.0.4.0 – Production
        启动日期                  24-11月-2014 20:52:17
        正常运行时间              7 天 17 小时 23 分 13 秒
        跟踪级别                  off
        安全性                    ON: Local OS Authentication
        SNMP                      OFF
        监听程序参数文件          D:\oracle\product\10g\network\admin\listener.ora
        监听程序日志文件          D:\oracle\product\10g\network\log\listener.log
        监听端点概要…
          (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=svr01)(PORT=1521)))
        服务摘要..
        服务 "+ASM" 包含 1 个例程。
          例程 "+asm2", 状态 BLOCKED, 包含此服务的 1 个处理程序…
        服务 "+ASM_XPT" 包含 1 个例程。
          例程 "+asm2", 状态 BLOCKED, 包含此服务的 1 个处理程序…
        服务 "orcl" 包含 3 个例程。
          例程 "orcl1", 状态 READY, 包含此服务的 31 个处理程序…
          例程 "orcl2", 状态 READY, 包含此服务的 32 个处理程序…
          例程 "orclstd", 状态 READY, 包含此服务的 2 个处理程序…
        服务 "orcl_XPT" 包含 3 个例程。
          例程 "orcl1", 状态 READY, 包含此服务的 31 个处理程序…
          例程 "orcl2", 状态 READY, 包含此服务的 32 个处理程序…
          例程 "orclstd", 状态 READY, 包含此服务的 2 个处理程序…   –确实证实了一上判断,罪魁祸首
        命令执行成功
        5.证实备机是否主机名为hp
        C:\Documents and Settings\Administrator>hostname
        hp
        C:\Documents and Settings\Administrator>ping hp
        Pinging hp [192.168.0.80] with 32 bytes of data:
        Reply from 192.168.0.80: bytes=32 time<1ms TTL=128
        二、处理方法
        1.注销备机的remote_listener
        alter system set remote_listener='' scope=both;
        2.生产库重新reload监听
        C:\Documents and Settings\Administrator>lsnrctl reload
        LSNRCTL for 64-bit Windows: Version 10.2.0.4.0 – Production on 02-12月-2014 14:18:51
        Copyright (c) 1991, 2007, Oracle.  All rights reserved.
        正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
        命令执行成功
        C:\Documents and Settings\Administrator>lsnrctl status
        LSNRCTL for 64-bit Windows: Version 10.2.0.4.0 – Production on 02-12月-2014 14:18:57
        Copyright (c) 1991, 2007, Oracle.  All rights reserved.
        正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
        LISTENER 的 STATUS
        ————————
        别名                      LISTENER
        版本                      TNSLSNR for 64-bit Windows: Version 10.2.0.4.0 – Production
        启动日期                  24-11月-2014 20:52:17
        正常运行时间              7 天 17 小时 26 分 40 秒
        跟踪级别                  off
        安全性                    ON: Local OS Authentication
        SNMP                      OFF
        监听程序参数文件          D:\oracle\product\10g\network\admin\listener.ora
        监听程序日志文件          D:\oracle\product\10g\network\log\listener.log
        监听端点概要…
          (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=svr01)(PORT=1521)))
        服务摘要..
        服务 "+ASM" 包含 1 个例程。
          例程 "+asm2", 状态 BLOCKED, 包含此服务的 1 个处理程序…
        服务 "+ASM_XPT" 包含 1 个例程。
          例程 "+asm2", 状态 BLOCKED, 包含此服务的 1 个处理程序…
        服务 "orcl" 包含 2 个例程。
          例程 "orcl1", 状态 READY, 包含此服务的 31 个处理程序…
          例程 "orcl2", 状态 READY, 包含此服务的 1 个处理程序…
        服务 "orcl_XPT" 包含 2 个例程。
          例程 "orcl1", 状态 READY, 包含此服务的 31 个处理程序…
          例程 "orcl2", 状态 READY, 包含此服务的 1 个处理程序…  –orclstd已经消失了
        命令执行成功
        3.客户端再次利用orcl连接数据库正常
        D:\>sqlplus system/abc123@orcl
        SQL*Plus: Release 10.2.0.1.0 – Production on 星期二 12月 2 14:21:01 2014
        Copyright (c) 1982, 2005, Oracle.  All rights reserved.
        连接到:
        Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
        With the Partitioning, Real Application Clusters, OLAP, Data Mining
        and Real Application Testing options
        SQL> show parameter name
        NAME                                 TYPE        VALUE
        ———————————— ———– ——————————
        db_file_name_convert                 string
        db_name                              string      orcl
        db_unique_name                       string      orcl
        global_names                         boolean     FALSE
        instance_name                        string      orcl2
        lock_name_space                      string
        log_file_name_convert                string
        service_names                        string      orcl

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31547506/viewspace-2925925/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2019-05-22

  • 博文量
    122
  • 访问量
    99612