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

飞舞的羽毛:在使用别人写的工具进行数据库连接的时候,提示ORA-28040错误,按照网上的方法进行修改以后提示密码错误ORA-01017,最后在原博主那里得到了解决,非常感谢,转载过来,没有经过博主的许可,但是文章甚好!益处甚多!共同学习!

2018-08-31 15:15106961原创Oracle 18c

本文链接:https://www.cnblogs.com/scoluo/p/13864672.html

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

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

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

1. 问题重现

数据库服务端版本:

[[email protected] 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/[email protected]: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/[email protected]: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。

其他可选值如下:

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

这里修改如下:

[[email protected] 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
[[email protected] admin]$

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

C:/Users/Dave>sqlplus system/[email protected]: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/[email protected]: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/[email protected]: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个错误。

猜你喜欢

转载自blog.csdn.net/u010472858/article/details/110151041