hosts文件权限导致监听无法启动
1.所属系统:
ZHJS2#[/]uname -a
HP-UX ZHJS2 B.11.31 U ia64 2866286647 unlimited-user license
2.问题描述:
修改主机名后,数据库监听无法启动,查看listener.ora文件如下:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ZHJS2)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /Oracle
SID_LIST_LISTENER =
(SID_LIST=
(SID_DESC=
(SID_NAME=ZHJS2)
(ORACLE_HOME=/Oracle/product/11.2.0.3/dbhome_1)
)
)
使用lsnrctl start启动的时候报无法识别主机名,但是在操作系统级别使用hostname查看确实是ZHJS2,和/etc/hosts文件也可以对应,为什么会报无法识别呢?
然后干脆不适用主机名,把HOST后面直接加IP地址,依然不行,如下:
ZHJS2$[/Oracle]lsnrctl
LSNRCTL for HPUX: Version 11.2.0.3.0 - Production on 09-MAR-2016 20:32:58
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=132.32.24.7)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
HPUX Error: 239: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
HPUX Error: 239: Connection refused
LSNRCTL> start
Starting /Oracle/product/11.2.0.3/dbhome_1/bin/tnslsnr: please wait...
TNS-12537: TNS:connection closed
TNS-12560: TNS:protocol adapter error
TNS-00507: Connection closed
HPUX Error: 29: Illegal seek
报:TNS-12537 TNS-00507
3.解决
经过一段时间的排查和尝试以及和其他机器相比,发现oracle用户无法读取hosts文件,查看hosts文件权限
ZHJS2#[/]ls -l /etc/hosts
-rw------- 1 root sys 1256 Mar 9 20:23 /etc/hosts
**修改hosts文件权限**
ZHJS2#[/]chmod 644 /etc/hosts
修改后再次启动监听,成功!!!
4.参考
My support oracle :
ID 315720.1
Verify the user attempting to start the TNS Listener process has read permissions on the /etc/hosts file, and that the /etc/hosts file contains the localhost entry in the following form:
127.0.0.1 localhost.localdomain localhost
12.123.123.12 myhost.us.oracle.com myhost
???疑点:为什么修改主机名会使hosts文件权限发生改变
笔记