今天忽然想看下12c的一个小东东,结果遇到ORA-12537:
我这个VM当初装的很别扭,前一段又折腾了一下,更加别扭了,主要问题如下:
1,初始加盘的时候整的太小了,只给了12G,结果装了grid后,再装oracle软件就很困难,这里grid的所在的盘mount在/u01这个目录下
2,然后增加了一块盘,结果没吸取教训,继续折腾太小了,还是12G,不过12c可以装上玩了,这个oracle的软件所在的盘mount在 /u01/app/oracle目录下
3,前一段时间觉得磁盘空间不够了,于是把一个11.2的vm的软件使用root用户tar过来,解压后,ORACLE_BASE和ORACLE_HOME目录是:/u01/app/oracle(这个跟12c的oracle软件是同一个ORACLE_BASE)和/u01/app/oracle/product/11.2.0.3/dbhome_1
够乱了吧,O(∩_∩)O哈哈~
[oracle@lunar admin]$ sqlplus sys/oracle@lunarbb as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 11 20:57:10 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. ERROR: ORA-12537: TNS:connection closed Enter user-name: ^C [oracle@lunar admin]$
检查listener.log:
<msg time='2013-11-11T21:02:56.404+08:00' org_id='oracle' comp_id='tnslsnr' type='UNKNOWN' level='16' host_id='lunar' host_addr='127.0.0.1'> <txt>11-NOV-2013 21:02:56 * service_update * lunarbb * 0 </txt> </msg> <msg time='2013-11-11T21:02:56.672+08:00' org_id='oracle' comp_id='tnslsnr' type='UNKNOWN' level='16' host_id='lunar' host_addr='127.0.0.1'> <txt>11-NOV-2013 21:02:56 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=lunarbb)(CID=(PROGRAM=sqlplus@lunar)(HOST=lunar)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.129)(PORT=50873)) * establish * lunarbb * 12518 </txt> </msg> <msg time='2013-11-11T21:02:56.787+08:00' org_id='oracle' comp_id='tnslsnr' type='UNKNOWN' level='16' host_id='lunar' host_addr='127.0.0.1'> <txt>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 </txt> </msg> <msg time='2013-11-11T21:03:01.752+08:00' org_id='oracle' comp_id='tnslsnr' type='UNKNOWN' level='16' host_id='lunar' host_addr='127.0.0.1'> <txt>11-NOV-2013 21:03:01 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=lunar)(USER=grid))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=202375424)) * status * 0 </txt> </msg>
发现报错:TNS-12518: TNS:listener could not hand off client connection
于是google,mos,设置一堆乱七八糟参数,并设置了trace:
[oracle@lunar admin]$ vi sqlnet.ora NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) SQLNET.ALLOWED_LOGON_VERSION = 10 SQLNET.INBOUND_CONNECT_TIMEOUT=180 SQLNET_ALLOWED_LOGON_VERSIONS=(12,11,10,9,8,7) #tcp.validnode_checking=false DIAG_ADR_ENABLED=on ADR_BASE=/u01/app/oracle/product/12.1/dbhome_1/network/trace TRACE_LEVEL_CLIENT=16 TRACE_LEVEL_SERVER=16
trace中最后出问题的信息如下,貌似是某些文件找不到或者权限问题:
[11-NOV-2013 21:30:30:931] nrigbni: entry [11-NOV-2013 21:30:30:931] nrigbni: Unable to get data from navigation file tnsnav.ora [11-NOV-2013 21:30:30:931] nrigbni: exit [11-NOV-2013 21:30:30:931] nrigbi: exit [11-NOV-2013 21:30:30:931] nigini: exit [11-NOV-2013 21:30:30:931] nszgwop: entry [11-NOV-2013 21:30:30:931] nszgwop: SQLNET.WALLET_OVERRIDE not found, using default. [11-NOV-2013 21:30:30:931] nszgwop: exit
使用strace sqlplus sys/oracle@lunarbb as sysdba进行跟踪,发现了如下可以信息:
貌似写什么东西时报错了
lseek(11, 248320, SEEK_SET) = 248320 read(11, "\r\0\3710\0\0V\0\3720\0\0k\0\3730\0\0\207\0\3740\0\0\245\0\3750\0\0\314\0"..., 512) = 512 close(11) = 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 ) = 33 write(1, "\n", 1 ) = 1 write(1, "\n", 1 ) = 1 write(1, "Enter user-name: ", 17Enter user-name: ) = 17 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f922d7c5000 read(0, [root@lunar ~]# cd /proc/1/fd [root@lunar fd]# ll total 0 lrwx------ 1 root root 64 Nov 11 22:21 10 -> /dev/initctl [root@lunar fd]#
MOS了一下,Troubleshooting ORA-12537 / TNS-12537 TNS:Connection Closed (Doc ID 555609.1)
发现,我的这个文件没啥问题,权限都对:
[oracle@lunar ~]$ ll $ORACLE_HOME/bin/oracle -rwxr-s--x 1 oracle asmadmin 293719944 Jun 16 11:43 /u01/app/oracle/product/12.1/dbhome_1/bin/oracle [oracle@lunar ~]$ <strong>于是,瞎折腾了一下:</strong> [root@lunar ~]# chown oracle:oinstall /u01/app/oracle/product/12.1/dbhome_1/bin/oracle [root@lunar ~]# <strong>重启下ORACLE还是不行:</strong> [oracle@lunar ~]$ ss SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 11 22:45:11 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected. SYS@lunarbb>shutdown abort ORACLE instance shut down. SYS@lunarbb>exit Disconnected [oracle@lunar ~]$ ss SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 11 22:45:25 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SYS@lunarbb>startup ORACLE instance started. Total System Global Area 346562560 bytes Fixed Size 2288240 bytes Variable Size 297797008 bytes Database Buffers 37748736 bytes Redo Buffers 8728576 bytes Database mounted. Database opened. SYS@lunarbb>conn sys/oracle@lunarbb as sysdba ERROR: ORA-12537: TNS:connection closed Warning: You are no longer connected to ORACLE. SYS@lunarbb>
这时候,看见刚刚修改过的oracle文件权限不对了,再重新修改回去:
[root@lunar ~]# chown oracle:asmadmin /u01/app/oracle/product/12.1/dbhome_1/bin/oracle [root@lunar ~]# ll /u01/app/oracle/product/12.1/dbhome_1/bin/oracle -rwxr-x--x 1 oracle asmadmin 293719944 Jun 16 11:43 /u01/app/oracle/product/12.1/dbhome_1/bin/oracle [root@lunar ~]# [root@lunar ~]# chmod 6751 /u01/app/oracle/product/12.1/dbhome_1/bin/oracle [root@lunar ~]# ll /u01/app/oracle/product/12.1/dbhome_1/bin/oracle -rwsr-s--x 1 oracle asmadmin 293719944 Jun 16 11:43 /u01/app/oracle/product/12.1/dbhome_1/bin/oracle [root@lunar ~]#
重启下ORACLE,再测试,居然好了,O(∩_∩)O哈哈~:
[oracle@lunar ~]$ ss SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 11 22:47:21 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected. SYS@lunarbb>shutdown abort ORACLE instance shut down. SYS@lunarbb>exit Disconnected [oracle@lunar ~]$ ss SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 11 22:47:35 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SYS@lunarbb>startup ORACLE instance started. Total System Global Area 346562560 bytes Fixed Size 2288240 bytes Variable Size 297797008 bytes Database Buffers 37748736 bytes Redo Buffers 8728576 bytes Database mounted. Database opened. SYS@lunarbb>conn sys/oracle@lunarbb as sysdba Connected. SYS@lunarbb>