Oracle 低版本客戶端連接 18c 報ORA-28040 和 ORA-01017 錯誤的解決方法


 

Oracle 低版本客戶端連接 18c 報ORA-28040 和 ORA-01017 錯誤的解決方法

2018-08-31 15:1510696 1 原創Oracle 18c

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。

 

其他可選值如下:

   
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

這里修改如下:

[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個錯誤。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM