sqlplus scott/system@ora10g报错ORA-12537: TNS:connection closed
结论
1,ORA-12537: TNS:connection closed此报错因为$ORACLE_HOME/bin/oracle权限不对
2,根据正常的权限调整上述文件的权限
3,调整过程如下:
11.2.0.1
[oracle@seconary admin]$ ll -l $ORACLE_HOME/bin/oracle*
-rwsr-s--x 1 oracle oinstall 210824714 Aug 26 2013 /oracle/product/11.2.0/db_1/bin/oracle
-rwxr-x--- 1 oracle oinstall 0 Aug 15 2009 /oracle/product/11.2.0/db_1/bin/oracleO
10.2.0.5
[ora10g@seconary admin]$ ll -l $ORACLE_HOME/bin/oracle*
-rwxr-x--x 1 ora10g oinstall 125153402 Apr 18 2014 /home/ora10g/product/10.2.0/db_1/bin/oracle
-rwxr-x--- 1 ora10g oinstall 0 Apr 20 2010 /home/ora10g/product/10.2.0/db_1/bin/oracleO
[root@seconary ~]# chmod --reference /oracle/product/11.2.0/db_1/bin/oracle /home/ora10g/product/10.2.0/db_1/bin/oracle
[root@seconary ~]#
10.2.0.5
[ora10g@seconary admin]$ ll -l $ORACLE_HOME/bin/oracle*
-rwsr-s--x 1 ora10g oinstall 125153402 Apr 18 2014 /home/ora10g/product/10.2.0/db_1/bin/oracle
-rwxr-x--- 1 ora10g oinstall 0 Apr 20 2010 /home/ora10g/product/10.2.0/db_1/bin/oracleO
连接正常
[oracle@seconary ~]$ sqlplus scott/system@ora10g
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 6 05:50:50 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
问题:
通过监听连接报错
[oracle@seconary help]$ sqlplus scott/system@ora10g
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 6 04:59:16 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
ERROR:
ORA-12537: TNS:connection closed
STRACE跟踪分析
[oracle@seconary help]$ strace sqlplus scott/system@ora10g
lstat("/home/oracle/oradiag_oracle/diag/clients/user_oracle/host_1191907454_76/trace/sqlnet.log", {st_mode=S_IFREG|0640, st_size=298601, ...}) = 0
open("/home/oracle/oradiag_oracle/diag/clients/user_oracle/host_1191907454_76/trace/sqlnet.log", O_WRONLY|O_CREAT|O_APPEND, 0660) = 10
write(10, " nt OS err code: 0/n", 22) = 22
close(10) = 0
munmap(0x2b4766bda000, 528384) = 0
open("/oracle/product/11.2.0/db_1/rdbms/mesg/oraus.msb", O_RDONLY) = 10
fcntl(10, F_SETFD, FD_CLOEXEC) = 0
lseek(10, 0, SEEK_SET) = 0
read(10, "/25/23/"/1/23/3/t/t/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0"..., 256) = 256
lseek(10, 512, SEEK_SET) = 512
read(10, "v/31/3533/351J/370h7~/262/211/336/230/301/3303/373/0/0/0/0/0/0/0/0/0/0/0/0/0/0"..., 512) = 512
lseek(10, 1536, SEEK_SET) = 1536
read(10, "/203/31/217/31/231/31/241/31/253/31/264/31/310/31/323/31,/0328/32Q/32`/32m/32{/32/222/32/232/32"..., 512) = 512
lseek(10, 242688, SEEK_SET) = 242688
read(10, "/r/0/3600/0/0V/0/3610/0/0/232/0/3630/0/0/327/0/3640/0/0/361/0/3650/0/0/5/1"..., 512) = 512
close(10) = 0
lseek(4, 5120, SEEK_SET) = 5120
read(4, "/r/0/351/0/0/0V/0/352/0/0/0/220/0/353/0/0/0/240/0/356/0/0/0/320/0/357/0/0/0/344/0"..., 512) = 512
write(1, "ERROR:/n", 7ERROR:
) = 7
write(1, "ORA-12537: TNS:connection closed"..., 33ORA-12537: TNS:connection closed
Fri Nov 06 04:59:16 2015
Directory does not exist for read/write [/oracle/product/11.2.0/db_1/log] [/oracle/product/11.2.0/db_1/log/diag/clients]
***********************************************************************
Fatal NI connect error 12537, connecting to:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.0.3)(PORT=1981)))(CONNECT_DATA=(SERVICE_NAME=ora10g)(CID=(PROGRAM=sqlplus)(HOST=seconary)(USER=oracle))))
VERSION INFORMATION:
TNS for Linux: Version 11.2.0.1.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
Time: 06-NOV-2015 04:59:17
Tracing not turned on.
Tns error struct:
ns main err code: 12537
TNS-12537: TNS:connection closed
ns secondary err code: 12560
nt main err code: 507
TNS-00507: Connection closed
nt secondary err code: 0
nt OS err code: 0
手工创建上述没有的目录
[oracle@seconary rdbms]$ ll -l /oracle/product/11.2.0/db_1/log/diag/clients
ls: /oracle/product/11.2.0/db_1/log/diag/clients: No such file or directory
[oracle@seconary rdbms]$ mkdir -p /oracle/product/11.2.0/db_1/log/diag/clients
[oracle@seconary rdbms]$
还是不成
[oracle@seconary rdbms]$ sqlplus scott/system@ora10g
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 6 05:06:20 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
ERROR:
ORA-12537: TNS:connection closed
Enter user-name:
11.2.0.1
[oracle@seconary admin]$ ll -l $ORACLE_HOME/bin/oracle*
-rwsr-s--x 1 oracle oinstall 210824714 Aug 26 2013 /oracle/product/11.2.0/db_1/bin/oracle
-rwxr-x--- 1 oracle oinstall 0 Aug 15 2009 /oracle/product/11.2.0/db_1/bin/oracleO
10.2.0.5
[ora10g@seconary admin]$ ll -l $ORACLE_HOME/bin/oracle*
-rwxr-x--x 1 ora10g oinstall 125153402 Apr 18 2014 /home/ora10g/product/10.2.0/db_1/bin/oracle
-rwxr-x--- 1 ora10g oinstall 0 Apr 20 2010 /home/ora10g/product/10.2.0/db_1/bin/oracleO
[root@seconary ~]# chmod --reference /oracle/product/11.2.0/db_1/bin/oracle /home/ora10g/product/10.2.0/db_1/bin/oracle
[root@seconary ~]#
10.2.0.5
[ora10g@seconary admin]$ ll -l $ORACLE_HOME/bin/oracle*
-rwsr-s--x 1 ora10g oinstall 125153402 Apr 18 2014 /home/ora10g/product/10.2.0/db_1/bin/oracle
-rwxr-x--- 1 ora10g oinstall 0 Apr 20 2010 /home/ora10g/product/10.2.0/db_1/bin/oracleO
连接正常
[oracle@seconary ~]$ sqlplus scott/system@ora10g
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 6 05:50:50 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
正文到此结束