今天同事的plsql连接不上数据库,我用他的本地tnsping是不通的,于是上服务器上查看下,结果发现监听没起来,不知道怎么就断了
再次尝试重启
lsnrctl start
发现直接报错:
NSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/edsir4p1/listener/alert/log.xml
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edsor4p1.us.oracle.com)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
Linux Error: 111: Connection refused
这个报错,仔细看,显示的是 target host or object does not exist
于是乎查看/etc/hosts在用hostname命令和文件对比,果然被修改了
在/etc/hosts中添加上自己的主机名
[oracle@edsir4p1-PROD1 ~]$ more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 zclinux localhost
10.190.104.111 edsir4p1.us.oracle.com edsir4p1
10.190.104.28 edsir1p8.us.oracle.com edsir1p8
查看下监听的配置文件和本地服务名的配置文件
listener.ora
查看改文件发现,hosts文件修改了,但是监听配置文件还有问题,于是修改后,保存退出
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = zclinux)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
参考:
http://blog.itpub.net/26736162/viewspace-2144915/