Oracle数据库之【故障处理】ORA-28040: No matching authentication protocol
小标 2018-08-21 来源 : 阅读 1463 评论 0

摘要:本文主要向大家介绍了Oracle数据库之【故障处理】ORA-28040: No matching authentication protocol,通过具体的内容向大家展现,希望对大家学习Oracle数据库有所帮助。

本文主要向大家介绍了Oracle数据库之【故障处理】ORA-28040: No matching authentication protocol,通过具体的内容向大家展现,希望对大家学习Oracle数据库有所帮助。

1.1  BLOG文档结构图

 

1.2  前言部分

1.2.1  导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

① 告警日志中频繁出现Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter、ORA-28040: No matching authentication protocol错误,9i的客户端连接到12c高版本的解决方案

② Windows下使用oerr命令

Tips:

① 本文在itpub(//blog.itpub.net/26736162)、博客园(//www.cnblogs.com/lhrbest)和微信公众号(xiaomaimiaolhr)上有同步更新。

② 文章中用到的所有代码、相关软件、相关资料及本文的pdf版本都请前往小麦苗的云盘下载,小麦苗的云盘地址见://blog.itpub.net/26736162/viewspace-1624453/。

③ 若网页文章代码格式有错乱,请下载pdf格式的文档来阅读。

④ 在本篇BLOG中,代码输出部分一般放在一行一列的表格中。

本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。

1.3  故障分析及解决过程

1.3.1  故障环境介绍

 

项目

   

source db

   

db 类型

   

RAC

   

db version

   

12.1.0.2.0

   

db 存储

   

ASM

   

OS版本及kernel版本

   

SuSE Linux Enterprise Server(SLES11) 64位

   

 

1.3.2  故障发生现象及报错信息

告警日志中频繁出现Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter。

或JDBC连接Oracle12c报如下错误:

Caused by: java.sql.SQLException: ORA-28040: No matching authentication protocol

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)

        at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:294)

        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:357)

        at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:441)

        at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:165)

        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)

        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)

        at java.sql.DriverManager.getConnection(DriverManager.java:582)

        at java.sql.DriverManager.getConnection(DriverManager.java:154)

 

   

 

或者使用9i的客户端去连接12c的数据库就会报ORA-28040: No matching authentication protocol这个错误。

1.3.3  故障分析及解决过程

使用oerr命令来查看,在Oracle 11g下:

[oracle@orcltest ~]$ oerr ora 28040

28040, 0000, "No matching authentication protocol"

// *Cause:  No acceptible authentication protocol for both client and server

// *Action: Administrator should set SQLNET_ALLOWED_LOGON_VERSION parameter

//          on both client and servers to values that matches the minimum

//          version supported in the system.

[oracle@orcltest ~]$

 

   

12c下:

oracle@HQsPSL-PSCV-R02:/oracle/app/oracle> oerr ora 28040

28040, 0000, "No matching authentication protocol"

// *Cause:  There was no acceptable authentication protocol for

//          either client or server.

// *Action: The administrator should set the values of the

//          SQLNET.ALLOWED_LOGON_VERSION_SERVER and

//          SQLNET.ALLOWED_LOGON_VERSION_CLIENT parameters, on both the

//          client and on the server, to values that match the minimum

//          version software supported in the system.

//          This error is also raised when the client is authenticating to

//          a user account which was created without a verifier suitable for

//          the client software version. In this situation, that account's

//          password must be reset, in order for the required verifier to

 

   

可以看到,该参数在11g和12c下的解决方案是不同的。

查询了一下参数SQLNET.ALLOWED_LOGON_VERSION,发现该参数在12c中以废弃,而是采用SQLNET.ALLOWED_LOGON_VERSION_CLIENT和SQLNET.ALLOWED_LOGON_VERSION_SERVER代替。

客户说是之前碰到了ORA-28040: No matching authentication protocol的错误才加上该参数的。

解决:在Oracle用户(不是grid用户)下,将$ORACLE_HOME/network/admin/sqlnet.ora文件原来的SQLNET.ALLOWED_LOGON_VERSION=8注释掉(如果没有sqlnet.ora文件,那么就创建一个),修改为如下的行:

SQLNET.ALLOWED_LOGON_VERSION_SERVER=8

SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8

   

不用重启数据库或者监听,也不用重启应用。

区别如下:

SQLNET.ALLOWED_LOGON_VERSION_SERVER:控制可以连接到12c数据库的客户端版本(client --->orace 12c db )

SQLNET.ALLOWED_LOGON_VERSION_CLIENT:控制12c数据库可以连到哪些版本的数据库(orace 12c db  --->其它版本的oracle db),例如:控制通过DB LINK可连接到哪些版本的oracle库。

所以,该案例中主要起作用的是需要配置SQLNET.ALLOWED_LOGON_VERSION_SERVER。

特别需要注意:

(1)如果是RAC,因为RAC是使用grid的监听器,因此很多人以为是在“/u02/app/12.1.0/grid/network/admin/sqlnet.ora” 加“SQLNET.ALLOWED_LOGON_VERSION_SERVER=8”,其实这是错的,而是仍然在$ORACLE_HOME/network/admin/sqlnet.ora加“SQLNET.ALLOWED_LOGON_VERSION_SERVER=8”

(2)上面所说的版本,是指dba_users.password_versions的版本。

 

在Oracle 12c中,虽然在sqlnet.ora加SQLNET.ALLOWED_LOGON_VERSION=8可以解决问题,但由于这个参数在12c已经废弃了,而是用SQLNET.ALLOWED_LOGON_VERSION_CLIENT和SQLNET.ALLOWED_LOGON_VERSION_SERVER代替。如果继续使用该参数,会在告警日志中无穷无尽的报“Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter.”,如下所示:

 

 

另外,对于JDBC的报错也可以下载支持oracle12c的jdbc驱动jar包。链接://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html

注:本地jdk版本为1.6,则下载ojdbc6.jar;jdk版本为1.7,则下载ojdbc7.jar

如下图所示:

 

也可以在在ORACLE安装目录lib库目录下载ojdbc7.jar包,然后把这个ojdbc7.jar加载到开发环境中。

[oracle@orcltest dbhome_1]$ ll $ORACLE_HOME/jdbc/lib/ojdbc*

-rw-r--r-- 1 oracle oinstall 3447295 Aug 23  2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5dms_g.jar

-rw-r--r-- 1 oracle oinstall 2617019 Aug 23  2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5dms.jar

-rw-r--r-- 1 oracle oinstall 3425922 Aug 23  2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5_g.jar

-rw-r--r-- 1 oracle oinstall 2095661 Aug 23  2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5.jar

-rw-r--r-- 1 oracle oinstall 4486070 Aug 23  2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6dms_g.jar

-rw-r--r-- 1 oracle oinstall 3327656 Aug 23  2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6dms.jar

-rw-r--r-- 1 oracle oinstall 4462913 Aug 23  2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6_g.jar

-rw-r--r-- 1 oracle oinstall 2714016 Aug 23  2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6.jar

[oracle@orcltest dbhome_1]$

 

   

 

1.3.4  官方文档及MOS的解释

有关该问题,MOS上有很多文档可以供参考。

//docs.oracle.com/database/121/UPGRD/deprecated.htm#UPGRD60010




1.3.4.1  12c中弃用和不支持的特性

https://docs.oracle.com/database/121/UPGRD/deprecated.htm#BABEDDGA

 

 

1.4  ORA-28040故障模拟

小麦苗有7、8、9、10、11、12c的数据库,所以顺便模拟一下这个错误。

服务端为12c的数据库,客户端为9i,我们在客户端尝试连接12c的数据库:

Microsoft Windows [版本 10.0.10240]

(c) 2015 Microsoft Corporation. All rights reserved.

 

D:\Users\xiaomaimiao>set ORACLE_HOME=D:\Program_files\u01\app\oracle\product\ora92

 

D:\Users\xiaomaimiao>set ora

ORACLE10G=D:\Program files\app\oracle\product\10.2.0\db_1

ORACLE11G=D:\Program_files\u01\app\oracle\product\11.2.0.1\dbhome_1

ORACLE8I=D:\Program files\app\oracle\product\ora8i

ORACLE_HOME=D:\Program_files\u01\app\oracle\product\ora92

 

D:\Users\xiaomaimiao>cd %ORACLE_HOME%/bin

 

D:\Program_files\u01\app\oracle\product\ora92\bin>sqlplus -v

 

SQL*Plus: Release 9.2.0.1.0 - Production

 

 

D:\Program_files\u01\app\oracle\product\ora92\bin>tnsping ora12c

 

TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0 - Production on 19-DEC-2016 17:44:59

 

Copyright (c) 1997 Oracle Corporation.  All rights reserved.

 

Used parameter files:

D:\Program_files\u01\app\oracle\product\ora92\network\admin\sqlnet.ora

 

 

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.128)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = lhrdb12c)))

OK (10 msec)

 

D:\Program_files\u01\app\oracle\product\ora92\bin>sqlplus lhr/lhr@ora12c

 

SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 19 17:45:07 2016

 

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

 

ERROR:

ORA-28040: No matching authentication protocol

 

 

Enter user-name:

 

   

 

可以看到报ORA-28040: No matching authentication protocol的错误。

我们在服务端的$ORACLE_HOME/network/admin/sqlnet.ora添加如下的行:

SQLNET.ALLOWED_LOGON_VERSION_SERVER=8

SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8

   

重新尝试连接:

D:\Program_files\u01\app\oracle\product\ora92\bin>sqlplus lhr/lhr@ora12c

 

SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 19 17:51:54 2016

 

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

 

SQL>

 

   

可以看到已经正常连接了。

如果将服务端的$ORACLE_HOME/network/admin/sqlnet.ora中的SQLNET.ALLOWED_LOGON_VERSION_SERVER=8和SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8注释掉,而换成SQLNET.ALLOWED_LOGON_VERSION=8,如下:

SQLNET.ALLOWED_LOGON_VERSION=8

# SQLNET.ALLOWED_LOGON_VERSION_SERVER=8

# SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8

   

 

尝试连接数据库:

D:\Program_files\u01\app\oracle\product\ora92\bin>sqlplus lhr/lhr@ora12c

 

SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 19 17:56:29 2016

 

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

 

SQL>

 

   

可以正常连接,但是查看告警日志的时候有如下的输出:Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter. 而且,每连接一次数据库就输出一行该数据,和我们之前分析的问题是一致的。

1.5  Windows下使用oerr命令

由于客户的环境是12c Linux的,而自己没有12c的Linux环境,安装较为麻烦,索性就安装了一个Windows版本的。结果执行oerr ora 的时候报错了:

C:\Users\xiaomaimiao>oerr ora 10041

oerr: Cannot access the message file E:\app\oracle\product\12.1.0\dbhome_1\rdbms\mesg\oraus.msg

No such file or directory

 

C:\Users\xiaomaimiao>oerr ora 01555

oerr: Cannot access the message file E:\app\oracle\product\12.1.0\dbhome_1\rdbms\mesg\oraus.msg

No such file or directory

 

   

 

经查看报错的文件(E:\app\oracle\product\12.1.0\dbhome_1\rdbms\mesg\oraus.msg)的确没有,而且任何*.msg文件都不存在,那就从12c的Linux下把相关的$ORACLE_HOME/rdbms/mesg/*.msg文件都拷贝到Windows的环境下:

[oracle@orcltest mesg]$ pwd

/u02/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg

[oracle@orcltest mesg]$ ll *.msg          

-rw-r--r-- 1 oracle oinstall    4070 Jul 25  2008 amduus.msg

-rw-r--r-- 1 oracle oinstall    6298 Apr 14  2011 asmcmdus.msg

-rw-r--r-- 1 oracle oinstall    5886 Aug  3  2007 dbvus.msg

-rw-r--r-- 1 oracle oinstall   23309 Jan 28  2010 dgmus.msg

-rw-r--r-- 1 oracle oinstall  175881 May 11  2011 diaus.msg

-rw-r--r-- 1 oracle oinstall   49483 Jan 28  2010 expus.msg

-rw-r--r-- 1 oracle oinstall   15148 Nov  8  2009 gimus.msg

-rw-r--r-- 1 oracle oinstall   47609 Feb 18  2009 impus.msg

-rw-r--r-- 1 oracle oinstall    3585 Nov  3  2009 kfedus.msg

-rw-r--r-- 1 oracle oinstall    3457 Nov  6  2008 kfodus.msg

-rw-r--r-- 1 oracle oinstall    1792 Mar  1  2009 kfsgus.msg

-rw-r--r-- 1 oracle oinstall   26775 Nov  1  1999 kgpus.msg

-rw-r--r-- 1 oracle oinstall    3113 Sep  3  1997 kopus.msg

-rw-r--r-- 1 oracle oinstall   72528 Sep 17  2011 kupus.msg

-rw-r--r-- 1 oracle oinstall    4651 Sep  3  1997 lcdus.msg

-rw-r--r-- 1 oracle oinstall   22043 Nov 27  2006 nidus.msg

-rw-r--r-- 1 oracle oinstall  129827 May  5  2011 ocius.msg

-rw-r--r-- 1 oracle oinstall     734 Mar  8  2010 opwus.msg

-rw-r--r-- 1 oracle oinstall 4922454 Sep 17  2011 oraus.msg

-rw-r--r-- 1 oracle oinstall  178311 Aug 25  2009 qsmus.msg

-rw-r--r-- 1 oracle oinstall  391272 Sep 17  2011 rmanus.msg

-rw-r--r-- 1 oracle oinstall   40078 Jul 30  2001 sbtus.msg

-rw-r--r-- 1 oracle oinstall  123863 May 22  2010 smgus.msg

-rw-r--r-- 1 oracle oinstall   20433 Jan 13  2010 udeus.msg

-rw-r--r-- 1 oracle oinstall   20572 Jan 13  2010 udius.msg

-rw-r--r-- 1 oracle oinstall  143025 Jul 27  2009 ulus.msg

[oracle@orcltest mesg]$

 

   

然后执行就OK了。

C:\Users\xiaomaimiao>oerr ora 01555

01555, 00000, "snapshot too old: rollback segment number %s with name \"%s\" too small"

// *Cause: rollback records needed by a reader for consistent read are

//         overwritten by other writers

// *Action: If in Automatic Undo Management mode, increase undo_retention

//          setting. Otherwise, use larger rollback segments

本文由职坐标整理并发布,希望对同学们学习Oracle有所帮助,更多内容请关注职坐标数据库Oracle数据库频道!

本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程