Oracle 低版本客户端连接 18c 报ORA-28040 和 ORA-01017 错误的解决方法

Oracle 低版本客户端连接 18c 报ORA-28040 和 ORA-01017 错误的解决方法

 

 

现在oracle版本已发布至18c,那么在安装Oracle 12c 或者Oracle 18c之后,如果已低版本的客户端来连接12c或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 官方的说法,这里是bug,所以如果以低版本的客户端连接18c,需要特别留意这2个错误。

修改密码后一开始plsql登录还是不行,使用“本地Net服务名配置”中的测试,重新对密码测试了下 发现测试通过,登录成功,后改用plsql登录 就可以顺利登录了。

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值