遇到一个监听问题:
环境:Oracle Enterprise Linux 5.4 + 11.2.0.3.14
问题:使用lsnrctl 指令启动监听没问题,过十几秒后监听自动关闭,再启动,反复出现该问题。
根据经验,监听问题一般和/etc/hosts文件有关,瞄了一眼,似乎没有问题。
接下来第一时间当然去看日志啦。
$ORACLE_HOME/network/trace目录下找到了日志,并没有什么有用的信息。
------------监听日志在哪?(trace和log查看方式差不多)
-
[oracle@oracle151 trace]$ lsnrctl
-
-
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-DEC-2015 15:12:31
-
-
Copyright (c) 1991, 2011, Oracle. All rights reserved.
-
-
Welcome to LSNRCTL, type "help" for information.
-
-
LSNRCTL> show
-
The following operations are available after show
-
An asterisk (*) denotes a modifier or extended command:
-
-
rawmode displaymode
-
rules trc_file
-
trc_directory trc_level
-
log_file log_directory
-
log_status current_listener
-
inbound_connect_timeout startup_waittime
-
snmp_visible save_config_on_stop
-
dynamic_registration enable_global_dynamic_endpoint
-
oracle_home pid
-
connection_rate_limit
-
-
LSNRCTL> show log_directory
-
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle151.example.com)(PORT=1521)))
-
LISTENER parameter "log_directory" set to /u01/app/oracle/diag/tnslsnr/oracle151/listener/alert
-
The command completed successfully
-
LSNRCTL> show log_status
-
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle151.example.com)(PORT=1521)))
-
LISTENER parameter "log_status" set to ON
-
The command completed successfully
-
LSNRCTL> show log_file
-
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle151.example.com)(PORT=1521)))
-
LISTENER parameter "log_file" set to /u01/app/oracle/diag/tnslsnr/oracle151/listener/alert/log.xml
-
The command completed successfully
于是开始怀疑防火墙,检查了一下发现没关,使用chkconfig指令把防火墙关了,还是不行,于是重启,出现了新的报错:
-
[oracle@oracle152 log]$ lsnrctl start
-
-
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-DEC-2015 15:14:27
-
-
Copyright (c) 1991, 2011, Oracle. All rights reserved.
-
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
-
TNS-12537: TNS:connection closed
-
TNS-12560: TNS:protocol adapter error
-
TNS-00507: Connection closed
-
Linux Error: 29: Illegal seek
不死心,又回去翻/etc/hosts文件,天了噜!似乎发现了错误:
-
[oracle@oracle152 log]$ more /etc/hosts
-
# Do not remove the following line, or various programs
-
# that require network functionality will fail.
-
10.3.52.151 oracle151.example.com oracle151
-
10.3.52.152 oracle152.example.com oracle152
文件少了一行127.0.0.1的记录,重新加上:
-
[oracle@oracle152 log]$ more /etc/hosts
-
# Do not remove the following line, or various programs
-
# that require network functionality will fail.
-
127.0.0.1 localhost.localdomain localhost
-
10.3.52.151 oracle151.example.com oracle151
-
10.3.52.152 oracle152.example.com oracle152
再次启动监听
-
[oracle@oracle152 log]$ lsnrctl start
-
-
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-DEC-2015 15:18:32
-
-
Copyright (c) 1991, 2011, Oracle. All rights reserved.
-
-
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
-
-
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
-
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
-
Log messages written to /u01/app/oracle/diag/tnslsnr/oracle152/listener/alert/log.xml
-
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle152.example.com)(PORT=1521)))
-
-
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle152.example.com)(PORT=1521)))
-
STATUS of the LISTENER
-
------------------------
-
-
Alias LISTENER
-
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
-
Start Date 05-DEC-2015 15:18:33
-
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/db_1/network/admin/listener.ora
-
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle152/listener/alert/log.xml
-
Listening Endpoints Summary...
-
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle152.example.com)(PORT=1521)))
-
The listener supports no services
-
The command completed successfully
监听成功启动。
注:The listener supports no services是因为没有做静态注册,并没有问题。
总结:二十多年白活了,粗心的毛病还是没有改掉,第一次看的时候居然没有发现错误。别拉着我,让我哭一会。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29781254/viewspace-1854008/
,如需转载,请注明出处,否则将追究法律责任。