日期:2014-05-16  浏览次数:20609 次

sqlplus 连接数据库报错SP2-0642: SQL*Plus internal error state 2130, context 0:0:0
sqlplus 连接数据库报错SP2-0642: SQL*Plus internal error state 2130, context 0:0:0
问题描述:
使用sqlplus客户端登录数据库,报错SP2-0642,而使用其它方式plsql或者tnsnames等方式连接数据库均没有问题

[oracle@test2 ~]$ sqlplus adt/passwd@192.168.112.235:1521/srv_test1

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Oct 9 16:04:39 2013

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

SP2-0642: SQL*Plus internal error state 2130, context 0:0:0
Unsafe to proceed
Enter user-name:

原因:
The cause of this problem has been identified and verified in an unpublished Bug 6135152. ORA-25406 With Server Side TAF, And //HOST:PORT/SERVICE_NAME Connect String.
使用TAF连接并用EZCONNECT连接数据库时,触发了数据库相关bug


解决方法

方法1

1,去掉默认的端口号1521,可以解决

C:\Users\wj>sqlplus adt/passwd@192.168.112.235/srv_test1

SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 10月 9 16:09:00 2013

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


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management,
OLAP,
Data Mining and Real Application Testing options

SQL>


方法2,修改service的配置为默认选项
原有service创建方式
srvctl add service -d ms4adb -s srv_4a2 -r ms4adb -a ms4adb -P basic -e select -m basic -z 180 -w 5

现有service方式,使用默认参数配置,即可正常连接
srvctl add service -d ms4adb -s srv_4a2 -r ms4adb -a ms4ad


方法3,客户端sqlplus升级oracle 11.2,也可解决相关问题
Bug is fixed from release 11.2 onwards.
Check for one off patches for your release / platform via Patch 6135152

参考资料:
EZCONNECT Connections Error with SP2-0642: Sql*Plus Internal Error State 2130 (文档 ID 855965.1)
Bug 8599395 : EZCONNECT ERRORS WITH SP2-0642: SQL*PLUS INTERNAL ERROR STATE 2130, CONTEXT 0:0: