问题

在Oracle中,造成“ORA-28040: No matching authentication protocol”错误的原因是什么?

 

     答案

 

 该错误是由于SQL*Plus的版本和数据库服务器的版本不一致导致的,使用oerr命令来查看,在Oracle 11g下:

1[oracle@orcltest ~]$ oerr ora 28040
228040, 0000, "No matching authentication protocol"
3// *Cause:  No acceptible authentication protocol for both client and server
4// *Action: Administrator should set SQLNET_ALLOWED_LOGON_VERSION parameter 
5//          on both client and servers to values that matches the minimum 
6//          version supported in the system.
7[oracle@orcltest ~]$ 

 

12c下:

 1oracle@HQsPSL-R02:/oracle/app/oracle> oerr ora 28040
 228040, 0000, "No matching authentication protocol"
 3// *Cause:  There was no acceptable authentication protocol for 
 4//          either client or server.
 5// *Action: The administrator should set the values of the
 6//          SQLNET.ALLOWED_LOGON_VERSION_SERVER and 
 7//          SQLNET.ALLOWED_LOGON_VERSION_CLIENT parameters, on both the
 8//          client and on the server, to values that match the minimum 
 9//          version software supported in the system. 
10//          This error is also raised when the client is authenticating to 
11//          a user account which was created without a verifier suitable for
12//          the client software version. In this situation, that account's 
13//          password must be reset, in order for the required verifier to
14//          be generated and allow authentication to proceed successfully.
15

 

可以看到,该参数在Oracle 11g和12c以上版本中的解决方案是不同的。参数SQLNET_ALLOWED_LOGON_VERSION在Oracle 12c中已经废弃,而是采用SQLNET.ALLOWED_LOGON_VERSION_CLIENT和SQLNET.ALLOWED_LOGON_VERSION_SERVER代替。所以,碰到该文件时,解决方案为:

对于Oracle 12c以下版本,在文件$ORACLE_HOME/network/admin/sqlnet.ora中加入以下代码:

1SQLNET.ALLOWED_LOGON_VERSION=8

 

对于Oracle 12c及其以上版本,在文件$ORACLE_HOME/network/admin/sqlnet.ora中加入以下代码:

1SQLNET.ALLOWED_LOGON_VERSION_SERVER=8 #控制可以连接到12c数据库的客户端版本(client --->orace 12c db )
2SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8 #控制12c数据库可以连到哪些版本的数据库(orace 12c db  --->其它版本的oracle db),例如:控制通过DB LINK可连接到哪些版本的oracle库。

 

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

需要注意的是,在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.”。

 

 

 

 

作者:小麦苗

 

 

【DB笔试面试851】在Oracle中,造成“ORA-28040: No matching ...”错误的原因是什么?_面试

● 本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

● 版权所有,欢迎分享本文,转载请保留出处

●QQ群:230161599、618766405

● 提供Oracle OCP、OCM、高可用(rac+dg+ogg)和MySQL最实用的技能培训

● 题目解答若有不当之处,还望各位朋友批评指正,共同进步

【DB笔试面试851】在Oracle中,造成“ORA-28040: No matching ...”错误的原因是什么?_面试

长按下图识别二维码或微信扫描下图二维码来关注小麦苗的微信公众号:DB宝,学习最实用的数据库技术。

【DB笔试面试851】在Oracle中,造成“ORA-28040: No matching ...”错误的原因是什么?_ocp_03