TNS-12547 Linux Error: 104: Connection reset by peer

本文详细描述了如何解决Oracle数据库中出现的TNS-12547错误,通过修改`/etc/hosts`文件,确保网络配置正确,以及清空`listener.log`文件来解决日志文件过大的问题。同时,提供了重启监听服务的方法以确保数据库正常运行。

refs:

http://blog.youkuaiyun.com/daimin1983/article/details/4291661

http://space.itpub.net/index.php?action/viewspace/itemid/629063

---------------

TNS-12547 Linux Error: 104: Connection reset by peer

解决过程参考:http://blog.chinaunix.net/u/7121/showart_403812.html

[oracle@MyMachine log]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-JUN-2009 09:53:26

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /opt/oracle/product/10.2.1/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /opt/oracle/product/10.2.1/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/product/10.2.1/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MyMachine.localdomain)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyMachine.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
解决过程:
[oracle@MyMachine log]$ more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
10.10.5.24 MyMachine.localdomain
10.10.3.254 host54.localdomain

[root@MyMachine ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost #添加
10.10.5.24 MyMachine.localdomain
10.10.3.254 host54.localdomain

重新启动监听:
[oracle@MyMachine log]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-JUN-2009 09:55:47
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /opt/oracle/product/10.2.1/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /opt/oracle/product/10.2.1/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/product/10.2.1/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MyMachine.localdomain)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 23-JUN-2009 09:55:48
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/10.2.1/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/product/10.2.1/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MyMachine.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

在网上搜索一下,另一种TNS-12547: TNS:lost contact的情况,具体错误如下:
TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
Linux Error: 32: Broken pipe
原因:listener.log文件超过2G
解决方法:清空日志文件
[oracle@chicago ~]$ cd $ORACLE_HOME/network/log
[oracle@chicago log]$ cat /dev/null > listener.log

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/350519/viewspace-1056123/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/350519/viewspace-1056123/

### 启动监听服务 Oracle报错ORA-12541: TNS:no listener通常是由于监听服务未运行导致的。可以使用 `lsnrctl start` 命令来启动监听服务。如果监听服务已经启动,但仍然报错,可能是监听服务启动后又自动关闭,需检查监听配置文件是否存在错误[^2]。 ### 检查监听服务配置文件 监听配置文件 `listener.ora` 可能存在错误配置,例如监听地址、端口设置错误等。需要检查该文件确保其配置正确。示例配置如下: ```plaintext LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = your_host)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) ADR_BASE_LISTENER = /u01/app/oracle SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = your_global_dbname) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = your_sid_name) ) ) ``` ### 配置防火墙或安全组 防火墙或安全组限制可能会导致客户端无法连接到监听服务。需要确保防火墙允许监听服务使用的端口(通常是1521)进行通信。可以通过以下命令开放端口: ```bash sudo firewall-cmd --zone=public --add-port=1521/tcp --permanent sudo firewall-cmd --reload ``` ### 检查Oracle客户端配置文件 Oracle客户端配置文件 `tnsnames.ora` 可能存在错误配置,导致客户端无法找到监听服务。需要检查该文件确保其配置正确,例如: ```plaintext YOUR_SERVICE_NAME = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = your_host)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = your_service_name) ) ) ``` ### 检查网络连接 Linux Error: 111: Connection refused 错误通常表示网络连接被拒绝。需要检查客户端和服务器之间的网络连接是否正常,例如使用 `ping` 命令和 `telnet` 命令: ```bash ping your_host telnet your_host 1521 ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值