新装了1个11.2的oracle数据库,配置监听时总是无法启动,最后发现竟然是hosts文件的原因,下面详细信息。
1.启动监听:
[oracle@chenbo ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JAN-2011 15:12:46
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/ora11gR2/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/ora11gR2/diag/tnslsnr/chenbo/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.150.1)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.150.1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JAN-2011 15:12:46
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/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/ora11gR2/diag/tnslsnr/chenbo/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.150.1)(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
2.查看监听状态,却提示没有监听服务启动。
[oracle@chenbo dbs]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JAN-2011 15:30:16
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.150.1)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
3.查看监听日志:
[oracle@chenbo ~]$ tail -f /u01/app/oracle/ora11gR2/diag/tnslsnr/chenbo/listener/trace/listener.log
Trace information written to /u01/app/oracle/ora11gR2/diag/tnslsnr/chenbo/listener/trace/ora_20443_47949057950496.trc
Trace level is currently 0
Started with pid=20443
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.150.1)(PORT=1521)))
Listener completed notification to CRS on start
TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
WARNING: Subscription for node down event still pending
12-JAN-2011 14:25:47 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=chenbo)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=186646784)) * status * 0
Wed Jan 12 14:29:26 2011
System parameter file is /u01/app/oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/ora11gR2/diag/tnslsnr/chenbo/listener/alert/log.xml
Trace information written to /u01/app/oracle/ora11gR2/diag/tnslsnr/chenbo/listener/trace/ora_20479_47689240552224.trc
Trace level is currently 0
可以看到监听在启动的时候去读取了系统的主机名chenbo和登陆的用户oracle,因此这个主机名gaojf应该在/etc/hosts中唯一存在的,并且对oracle用户是可以使用的,
4.查看hosts文件,
[oracle@chenbo ~]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 chenbo
192.168.150.1 chenbo
#::1 localhost6.localdomain6 localhost6
5.刚开始尝试屏蔽 127.0.0.1行,重新启动服务器后,启动监听,还是错误。
后来修改127.0.0.1的机器名为localhost,如下:
[oracle@chenbo dbs]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
192.168.150.1 chenbo
# ::1 localhost6.localdomain6 localhost6
6.再次启动监听,可以看到已经成功启动了。
[oracle@chenbo dbs]$ lsnrctl start
[oracle@chenbo dbs]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JAN-2011 16:03:34
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.150.1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JAN-2011 15:43:47
Uptime 0 days 0 hr. 19 min. 47 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/ora11gR2/diag/tnslsnr/chenbo/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.150.1)(PORT=1521)))
Services Summary...
Service "orcl" has 2 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
©著作权归作者所有:来自51CTO博客作者gjm008的原创作品,如需转载,请注明出处,否则将追究法律责任
职场休闲lsnrctloracle 基础