【故障處理】ORA-28040: No matching authentication protocol
1> 告警日志中頻繁出現Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter、
ORA-28040: No matching authentication protocol錯誤
故障環境介紹
DB 類型:RAC
DB version:12.1.0.2
2> 故障發生現象及報錯信息
告警日志中頻繁出現Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter。 Sun Oct 27 08:34:58 2019 Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter. Sun Oct 27 08:34:58 2019 Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter. Sun Oct 27 08:34:58 2019 Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter. Sun Oct 27 08:34:58 2019 Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter. Sun Oct 27 08:34:58 2019 Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter. Sun Oct 27 08:34:58 2019 Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter. Sun Oct 27 08:34:58 2019 或JDBC連接Oracle12c報如下錯誤: Caused by: java.sql.SQLException: ORA-28040: No matching authentication protocol at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278) at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:294) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:357) at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:441) at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:165) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:154)
或者使用9i的客戶端去連接12c的數據庫就會報ORA-28040: No matching authentication protocol這個錯誤。
解決過程
使用oerr命令來查看,在Oracle 11g下:
1 [oracle@orcltest ~]$ oerr ora 28040 2 3 28040, 0000, "No matching authentication protocol" 4 5 // *Cause: No acceptible authentication protocol for both client and server 6 7 // *Action: Administrator should set SQLNET_ALLOWED_LOGON_VERSION parameter 8 9 // on both client and servers to values that matches the minimum 10 11 // version supported in the system. 12 13 [oracle@orcltest ~]$ 14 15 12c下: 16 17 oerr ora 28040 18 19 28040, 0000, "No matching authentication protocol" 20 21 // *Cause: There was no acceptable authentication protocol for 22 23 // either client or server. 24 25 // *Action: The administrator should set the values of the 26 27 // SQLNET.ALLOWED_LOGON_VERSION_SERVER and 28 29 // SQLNET.ALLOWED_LOGON_VERSION_CLIENT parameters, on both the 30 31 // client and on the server, to values that match the minimum 32 33 // version software supported in the system. 34 35 // This error is also raised when the client is authenticating to 36 37 // a user account which was created without a verifier suitable for 38 39 // the client software version. In this situation, that account's 40 41 // password must be reset, in order for the required verifier to 42 43
可以看到,該參數在11g和12c下的解決方案是不同的。
查詢了一下參數SQLNET.ALLOWED_LOGON_VERSION,發現該參數在12c中以廢棄,而是采用SQLNET.ALLOWED_LOGON_VERSION_CLIENT和SQLNET.ALLOWED_LOGON_VERSION_SERVER代替。
客戶說是之前碰到了ORA-28040: No matching authentication protocol的錯誤才加上該參數的。
解決:在Oracle用戶(不是grid用戶)下,將$ORACLE_HOME/network/admin/sqlnet.ora文件原來的SQLNET.ALLOWED_LOGON_VERSION=8注釋掉(如果沒有sqlnet.ora文件,那么就創建一個),修改為如下的行:
1 SQLNET.ALLOWED_LOGON_VERSION_SERVER=8 2 3 SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
不用重啟數據庫或者監聽,也不用重啟應用。
區別如下:
SQLNET.ALLOWED_LOGON_VERSION_SERVER:控制可以連接到12c數據庫的客戶端版本(client --->orace 12c db )
SQLNET.ALLOWED_LOGON_VERSION_CLIENT:控制12c數據庫可以連到哪些版本的數據庫(orace 12c db --->其它版本的oracle db),例如:控制通過DB LINK可連接到哪些版本的oracle庫。
所以,該案例中主要起作用的是需要配置SQLNET.ALLOWED_LOGON_VERSION_SERVER。
數據庫的認證協議並不是數據庫軟件的版本, 對應的是dba_users.password_versions的值, 12.2 默認只支持11g 和12c的密碼版本,如在11g中的密碼版本10g和11g組合, 12c中密碼版本是11g, 12c的組合,如果想使用10g的密碼版本需要修改sqlnet.allowed_logon_version_server 到11或更低的值。
sqlnet.allowed_logon_version_server 和sqlnet.allowed_logon_version_client配置的值是最小認證版本的值,如數據庫是12c, sqlnet.allowed_logon_version_server=10, 那10g,11g,12c的client都可以訪問,包含10g對應的JDBC驅動包。 sqlnet.allowed_logon_version_server是配置在數據庫服務器(被訪問端)的DB $ORACLE_HOME的sqlnet.ora(不是GI HOME),在12.2版本有效值應該是8,9,10,11,12,12A,
特別需要注意:
(1)如果是RAC,因為RAC是使用grid的監聽器,因此很多人以為是在“/u02/app/12.1.0/grid/network/admin/sqlnet.ora” 加“SQLNET.ALLOWED_LOGON_VERSION_SERVER=8”,其實這是錯的,而是仍然在$ORACLE_HOME/network/admin/sqlnet.ora加“SQLNET.ALLOWED_LOGON_VERSION_SERVER=8”
(2)上面所說的版本,是指dba_users.password_versions的版本。
在Oracle 12c中,雖然在sqlnet.ora加SQLNET.ALLOWED_LOGON_VERSION=8可以解決問題,但由於這個參數在12c已經廢棄了,而是用SQLNET.ALLOWED_LOGON_VERSION_CLIENT和SQLNET.ALLOWED_LOGON_VERSION_SERVER代替。如果繼續使用該
另外,對於JDBC的報錯也可以下載支持oracle12c的jdbc驅動jar包。鏈接:http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html
注:本地jdk版本為1.6,則下載ojdbc6.jar;jdk版本為1.7,則下載ojdbc7.jar
如下圖所示:
也可以在在ORACLE安裝目錄lib庫目錄下載ojdbc7.jar包,然后把這個ojdbc7.jar加載到開發環境中。
1 [oracle@orcltest dbhome_1]$ ll $ORACLE_HOME/jdbc/lib/ojdbc* 2 3 -rw-r--r-- 1 oracle oinstall 3447295 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5dms_g.jar 4 5 -rw-r--r-- 1 oracle oinstall 2617019 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5dms.jar 6 7 -rw-r--r-- 1 oracle oinstall 3425922 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5_g.jar 8 9 -rw-r--r-- 1 oracle oinstall 2095661 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5.jar 10 11 -rw-r--r-- 1 oracle oinstall 4486070 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6dms_g.jar 12 13 -rw-r--r-- 1 oracle oinstall 3327656 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6dms.jar 14 15 -rw-r--r-- 1 oracle oinstall 4462913 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6_g.jar 16 17 -rw-r--r-- 1 oracle oinstall 2714016 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6.jar 18 19 [oracle@orcltest dbhome_1]$
1.3.4 官方文檔及MOS的解釋
http://docs.oracle.com/database/121/UPGRD/deprecated.htm#UPGRD60010