服务器端listener、instance运行均正常,在服务器本地通过sqlplus “/as sysdba”跳过listener可正常连接数据库,但是无论在服务器本地还是远程客户端,通过listener却无法成功,报“ORA-12537: TNS:connection closed“错误,listener log中也同步报TNS-12518:TNS:listener could not hand off client connection / TNS-12547: TNS:lost contact/ TNS-12560: TNS:protocol adapter error / TNS-00517: Lost contact / LinuxError: 32: Broken pipe。
(1)检查服务器listener.ora、sqlnet.ora配置文件均正常
(2)检查listener运行状态也为正常
[grid@nwydptdb01 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 21-SEP-2015 20:12:07 Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 21-SEP-2015 19:51:42 Uptime 0 days 0 hr. 20 min. 25 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora Listener Log File /u01/app/grid/diag/tnslsnr/nwydptdb01/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.XX.XX.7)(PORT=11521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.XX.XX.9)(PORT=11521))) Services Summary... Service "mxxp" has 1 instance(s). Instance "mxxp1", status READY, has 1 handler(s) for this service... Service "mxxpXDB" has 1 instance(s). Instance "mxxp1", status READY, has 1 handler(s) for this service... The command completed successfully |
(3)服务器端使用sqlplus “/as sysdba”可以正常登陆数据库
[oracle@nwydptdb01 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 21 20:12:51 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options
SQL> select name from v$database;
NAME --------- MXXP
SQL> exit |
(4)服务器端tnsping正常
[oracle@nwydptdb01 ~]$ tnsping mxxp
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 21-SEP-2015 20:13:14
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.XX.XX.9)(PORT = 11521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mxxp))) OK (0 msec) |
(5)远程客户端tnsping也正常
C:\Users\Administrator>tnsping single
TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0 - Production on 21-9月 -2015 20:15:42
Copyright (c) 1997, 2014, Oracle. All rights reserved.
已使用的参数文件: C:\oracle\client\Administrator\product\12.1.0\client_1\network\admin\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名 尝试连接(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.XX.XX.9)(PORT = 11521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mxxp))) OK (0 毫秒) |
(6)服务器本地通过listener连接报ORA-12537: TNS:connection closed错误
[oracle@nwydptdb01 admin]$ sqlplus system/[email protected]:11521/mxxp
SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 21 19:55:40 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR: ORA-12537: TNS:connection closed |
(7)远程客户端通过listener连接数据库报ORA-12537: TNS:connection closed错误
C:\Users\Administrator>sqlplus system/oracle@mxxp SQL*Plus: Release 11.2.0.1.0 Production on 星期一 9月 21 19:41:12 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR: ORA-12537: TNS: 连接关闭 |
(8)查看listener日志,同步报出TNS-12518 / TNS-12547 / TNS-12560 / TNS-00517
21-SEP-2015 20:02:49 * (CONNECT_DATA=(SERVER=DEDICATED)(SID=mxxp1)(CID=(PROGRAM=D:\app\Administrator\product\11.2.0\dbhome_1\bin\sqlplus.exe)(HOST=GH-PC)(USER=Administrator))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.4.36.186)(PORT=50384)) * establish * mxxp1 * 12518 TNS-12518: TNS:listener could not hand off client connection TNS-12547: TNS:lost contact TNS-12560: TNS:protocol adapter error TNS-00517: Lost contact Linux Error: 32: Broken pipe |
3、原因分析
上文中所列出现象,符合metalink上文档 ID1069517.1的“SYMPTOMS”中“listener_scann.log or listener.log”部分描述现象。
检查$ORACLE_HOME/bin/oracle文件权限
[oracle@nwydptdb01 bin]$ ls -altr oracle -rwxr-s--x. 1 oracle asmdba 239810781 9月 10 17:55 oracle |
发现$ORACLE_HOME/bin/oracle文件的所属用户及组为oracle:asmdba,而权限为-rwxr-s—x,按照文章中说法,该权限是错误的,因为缺少suid(s)权限。
4、问题修复
修改$ORACLE_HOME/bin/oracle文件权限至具有s权限
[oracle@nwydptdb01 bin]$ chmod 6751 oracle [oracle@nwydptdb01 bin]$ ls -altr oracle -rwsr-s--x. 1 oracle asmdba 239810781 9月 10 17:55 oracle |
重新通过listener连接数据库,问题解决。
本文作者:黎俊杰(网名:踩点),从事”系统架构、操作系统、存储设备、数据库、中间件、应用程序“六个层面系统性的性能优化工作
欢迎加入 系统性能优化专业群,共同探讨性能优化技术。群号:258187244