一次Oracle监听无法动态注册处理过程排查分析

在之前的文章探讨过监听无法动态注册的问题,这一次又在不同的客户中碰到了相同的问题,遂记录之。
    客户反映他的数据库无法动态注册监听,监听状态显示如下
    引用
    $ lsnrctl status

LSNRCTL for HPUX: Version 10.2.0.3.0 – Production on 10-JUN-2011 16:38:16

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=130.123.12.89)(PORT=1521)))
    STATUS of the LISTENER
    ————————
    Alias LISTENER
    Version TNSLSNR for HPUX: Version 10.2.0.3.0 – Production
    Start Date 10-JUN-2011 16:35:38
    Uptime 0 days 0 hr. 2 min. 38 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /oracle/app/product/10.2/network/admin/listener.ora
    Listener Log File /oracle/app/product/10.2/network/log/listener.log
    Listening Endpoints Summary…
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=130.123.12.89)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
    Services Summary…
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service…
    Service "wesrmirr" has 1 instance(s).
    Instance "wesrmirr", status UNKNOWN, has 1 handler(s) for this service…
    The command completed successfully

可以看到监听端口为1521,而且local_listner参数为空,
    引用
    SQL> show parameter local

NAME TYPE VALUE
    ———————————— ———– ——————————
    local_listener string
    log_archive_local_first boolean TRUE

在这种情况下,理论上pmon会将实例状态动态注册至监听中。
    手动发起监听注册,也没有作用,监听状态依旧。
    引用
    SQL> alter system register;

System altered.

于是检查数据库检查日志,在启动日志出现无效地址字样
    引用
    PMON started with pid=3, OS id=2521
    Fri Jun 10 16:33:25 2011
    ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=unknown)(PORT=1521))'
    PSP0 started with pid=2, OS id=2526

进一步检查listener.ora文件和/etc/hosts文件
    引用
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /oracle/app/product/10.2)
    (PROGRAM = extproc)
    )
    (SID_DESC =
    (GLOBAL_DBNAME = wesrmirr)
    (ORACLE_HOME = /oracle/app/product/10.2)
    (SID_NAME = wesrmirr)
    )
    )

LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 130.123.12.89)(PORT = 1521))
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    )

可以看到ip地址130.123.12.89并没有出现在/etc/hosts配置文件中
    引用
    $ more /etc/hosts
    # @(#)B11.23_LRhosts $Revision: 1.9.214.1 $ $Date: 96/10/08 13:20:01 $
    #
    # The form for each entry is:
    #
    #
    # For example:
    # 192.1.2.34 hpfcrm loghost
    #
    # See the hosts(4) manual page for more information.
    # Note: The entries cannot be preceded by a space.
    # The format described in this file is the correct format.
    # The original Berkeley manual page contains an error in
    # the format description.
    #
    127.0.0.1 localhost loopback
    130.123.12.2 wesr-S-YWMIRROR

找到原因之后,解决方法也变得很简单,只要将130.123.12.89添加至/etc/hosts,再执行手动注册监听即可。


请使用浏览器的分享功能分享到微信等