操作系统:suse10
数据库:11.2.0.1.0 - 64bit
出现问题背景:服务器因为启动时间太长,ssh连接缓慢,重启服务器后,oracle监听无法启动
我们公司的测试服务器有好几个月没有重启了,现在ssh远程的时候特别慢,主管要求解决,在清理机器缓存无法解决问题后,重启了服务器,于是悲剧降临了:
oracle数据库可以正常启动,可是监听却始终无法启动,具体表现为:
1、lsnrctl start、lsnrctl status、lsnrctl status 领命,反应特慢,通常需要一分钟到两分钟才能有反应,而反应的结构就是,报了一堆错,如下:
oracle@linux-252:~> lsnrctl stATUS
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-OCT-2011 10:12:56
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux-252)(PORT=1521)))
TNS-12535: TNS:operation timed out
TNS-12560: TNS:protocol adapter error
TNS-00505: Operation timed out
TNS-12535: TNS:operation timed out
TNS-12560: TNS:protocol adapter error
TNS-00505: Operation timed out
oracle@linux-252:~> lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-OCT-2011 10:14:43
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /opt/oracle/product/11.1/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/product/11.1/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/linux-252/listener/alert/log.xml
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux-252)(PORT=1521)))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
System parameter file is /opt/oracle/product/11.1/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/linux-252/listener/alert/log.xml
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux-252)(PORT=1521)))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
Listener failed to start. See the error message(s) above...
2、使用netca重建数据库监听,在选择监听端口时,不管我选择默认的1521还是选择其他的端口,总是在等待数分钟后,提示端口被其他软件占用,
3、当根据oracle提示,去查看端口使用状态时,又显示端口是空闲的:
oracle@linux-252:~> netstat -antp | grep 1521
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 1 192.168.1.252:10677 202.106.195.30:1521 SYN_SENT 4598/ora_pmon_orcl
tcp 0 1 192.168.1.252:36842 202.106.199.37:1521 SYN_SENT 4546/java
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 1 192.168.1.252:10677 202.106.195.30:1521 SYN_SENT 4598/ora_pmon_orcl
tcp 0 1 192.168.1.252:36842 202.106.199.37:1521 SYN_SENT 4546/java
4、在被oracle一顿折腾后,又回到了原点,什么原因也没有找到,在确定了防火墙也是关闭的后,基本近乎绝望了---------找不到原因。
找不到原因也不能闲着啊,想了想问题的状态,监听也就是和网络有点关系,找到系统管理员,排查一下网络和系统吧,当看到hosts文件后,发现问题了:
oracle@linux-252:~> cat /etc/hosts
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
##
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
##
#127.0.0.1 localhost
#
## special IPv6 addresses
#::1 localhost ipv6-localhost ipv6-loopback
#
## special IPv6 addresses
#::1 localhost ipv6-localhost ipv6-loopback
#fe00::0 ipv6-localnet
#ff00::0 ipv6-mcastprefix
#ff02::1 ipv6-allnodes
#ff02::2 ipv6-allrouters
19dd2.168.1.252 linux-252.xxxxx linux-252
#124.42.93.202 linux-252.xxxxx linux-252
#ff02::1 ipv6-allnodes
#ff02::2 ipv6-allrouters
19dd2.168.1.252 linux-252.xxxxx linux-252
#124.42.93.202 linux-252.xxxxx linux-252
ip地址和主机名对应的地方出了点问题,ip地址中间多了个字母。
发现这个问题后,立马回去重新配置了下监听,一切OK,不管是查看状态,还是启动,netca,全都是立马出结果:
oracle@linux-252:~> lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-OCT-2011 10:41:20
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /opt/oracle/product/11.1/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/product/11.1/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/linux-252/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-252.soshare)(PORT=1521)))
System parameter file is /opt/oracle/product/11.1/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/linux-252/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-252.soshare)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux-252.soshare)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 28-OCT-2011 10:41:20
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11.1/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/linux-252/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-252.soshare)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 28-OCT-2011 10:41:20
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11.1/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/linux-252/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-252.soshare)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
5、问题到这应该差不多了,可是事实证明,问题不会是单个存在的,远程仍然连不上,
oracle@linux-252:~> lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-OCT-2011 10:46:04
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux-252.soshare)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
6、监听虽然起来了,但是查看状态却有个 linux系统错:
Linux Error: 111: Connection refused
7、查查资料,发现还是要改hosts文件,
oracle@linux-252:~> cat /etc/hosts
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
##
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
##
#127.0.0.1 localhost
#
## special IPv6 addresses
#::1 localhost ipv6-localhost ipv6-loopback
#
## special IPv6 addresses
#::1 localhost ipv6-localhost ipv6-loopback
#fe00::0 ipv6-localnet
#ff00::0 ipv6-mcastprefix
#ff02::1 ipv6-allnodes
#ff02::2 ipv6-allrouters
19dd2.168.1.252 linux-252.xxxxx linux-252
#124.42.93.202 linux-252.xxxxx linux-252
#ff02::1 ipv6-allnodes
#ff02::2 ipv6-allrouters
19dd2.168.1.252 linux-252.xxxxx linux-252
#124.42.93.202 linux-252.xxxxx linux-252
不知道那个缺心眼的,把#127.0.0.1 localhost, 注释掉了,
去掉注释,再看看:
oracle@linux-252:~> lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-OCT-2011 10:47:55
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux-252.soshare)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 28-OCT-2011 10:47:24
Uptime 0 days 0 hr. 0 min. 31 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11.1/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/linux-252/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-252.soshare)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl.soshare" has 1 instance(s)
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB.soshare" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "soshare.orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 28-OCT-2011 10:47:24
Uptime 0 days 0 hr. 0 min. 31 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11.1/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/linux-252/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-252.soshare)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl.soshare" has 1 instance(s)
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB.soshare" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "soshare.orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
8、测试一下连接,一切都正常了,问题总算解决了。
总结:1、之前lsnrctl status 查看状态慢,是因为hosts文件中,ip地址和主机名的对应关系出了问题,lister在启动时,找不到对应的主机。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25623297/viewspace-709830/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25623297/viewspace-709830/