温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

怎么解决Oracle低版本客户端连接报ORA-28040和ORA-01017错误

发布时间:2021-11-05 15:54:35 来源:亿速云 阅读:371 作者:iii 栏目:关系型数据库

本篇内容主要讲解“怎么解决Oracle低版本客户端连接报ORA-28040和ORA-01017错误”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么解决Oracle低版本客户端连接报ORA-28040和ORA-01017错误”吧!

Oracle 11g 的生命周期已经 ,18c 也已经正式发布,那么在安装Oracle 18c 之后,如果已低版本的客户端来连接18c ,就会报如下两个错误:

ORA-28040: No matching authentication protocol
ORA-01017: invalid username/password; logon denied

他们会先后出现,当解决ORA-28040错误后,就会出现ORA-01017错误。 这里重现一下错误并提供解决方法。

1. 问题重现

数据库服务端版本:

[oracle@www.cndba.cn dbs]$ sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Mon Aug 27 06:42:49 2018
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

客户端11.2.0.4,连接正常:

C:/Users/Dave>sqlplus system/oracle@192.168.56.168:1522/dave
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 31 09:24:53 2018
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
SQL>

但是11.2.0.1不行:

D:/instantclient_11>sqlplus system/oracle@192.168.56.168:1522/dave
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 8月 31 10:51:52 2018
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
ERROR:
ORA-28040: No matching authentication protocol
2. 处理ORA-28040错误

根据MOS文档 (ID 755605.1),ORA-28040的错误需要在Oracle 用户(非grid用户)的sqlnet.ora 文件中添加:
SQLNET.ALLOWED_LOGON_VERSION=8
或者使用更高版本的客户端。

但实际上,根据MOS文档(ID 2111876.1), 在Oracle 12c 以后的版本,
SQLNET.ALLOWED_LOGON_VERSION 参数已经弃用了,应该使用以下2个参数代替:
SQLNET.ALLOWED_LOGON_VERSION_SERVER = n
SQLNET.ALLOWED_LOGON_VERSION_CLIENT = n

这里的n默认为11. 第一个参数是客户端连接到服务器的时候启作用,第二个是做为客户端去连接其它数据库的时候启作用。例如创建db link。

其他可选值如下:



12afor Oracle Database 12c Release 1 (12.1) release 12.1.0.2 or later
12for the critical patch updates CPUOct2012 and later Oracle Database 11g authentication protocols (recommended)
11for Oracle Database 11g authentication protocols (default)
10for Oracle Database 10g authentication protocols
8for Oracle8i authentication protocol

这里修改如下:

[oracle@www.cndba.cn admin]$ cat sqlnet.ora 
# sqlnet.ora Network Configuration File: /u01/app/oracle/product/18.3.0/db_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
[oracle@www.cndba.cn admin]$

修改后即可生效,在连接报错如下:

C:/Users/Dave>sqlplus system/oracle@192.168.56.168:1522/dave
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 8月 31 14:49:53 2018
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
3. 处理ORA-01017错误

从错误提示看是用户名或者密码错误,实际上这里用户名和密码没有问题。 这里的问题是我们配置的sqlnet对之前已经存在的帐号并没有生效,他们还保持在之前的兼容性。

SQL> set pages 100
SQL> select username,password_versions from dba_users;
USERNAME               PASSWORD_VERSIONS
------------------------------ ----------------------------------
SYS                       11G 12C
SYSTEM                   11G 12C
OUTLN                   11G 12C
SYS$UMF                11G 12C
DBSNMP                   11G 12C
APPQOSSYS               11G 12C
DBSFWUSER               11G 12C
GGSYS                   11G 12C

这里的解决方法就是对用户修改下密码:

SQL> alter user sys identified by oracle;
User altered.
SQL> alter user system identified by oracle;
User altered.

查看密码版本:

SQL> select username,password_versions from dba_users;
USERNAME               PASSWORD_VERSIONS
------------------------------ ----------------------------------
SYS                         11G 12C
SYSTEM                   10G 11G 12C

注意这里虽然SYS并没有改变,但是SYSTEM的版本已经加上了10G。 实际上,现在这2个用户都可以连接了:

C:/Users/Dave>sqlplus system/oracle@192.168.56.168:1522/dave
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 8月 31 14:58:35 2018
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
连接到:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
SQL>
C:/Users/Dave>sqlplus sys/oracle@192.168.56.168:1522/dave as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 8月 31 14:58:54 2018
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
连接到:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
SQL>

到此,相信大家对“怎么解决Oracle低版本客户端连接报ORA-28040和ORA-01017错误”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI