【故障處理】ORA-28040: No matching authentication protocol

各位技術愛好者,看完本文後,你可以掌握如下的技能,也可以學到一些其它你所不知道的知識,~O(∩_∩)O~:
① 告警日志中頻繁出現Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter、ORA-28040: No matching authentication protocol錯誤,9i的用戶端連接配接到12c高版本的解決方案
② Windows下使用oerr指令
Tips:
③ 若網頁文章代碼格式有錯亂,請下載下傳pdf格式的文檔來閱讀。
④ 在本篇BLOG中,代碼輸出部分一般放在一行一列的表格中。
本文如有錯誤或不完善的地方請大家多多指正,ITPUB留言或QQ皆可,您的批評指正是我寫作的最大動力。
項目
source db
db 類型
RAC
db version
12.1.0.2.0
db 存儲
ASM
OS版本及kernel版本
SuSE Linux Enterprise Server(SLES11) 64位
告警日志中頻繁出現Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter。
或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下:
[oracle@orcltest ~]$ oerr ora 28040
28040, 0000, "No matching authentication protocol"
// *Cause: No acceptible authentication protocol for both client and server
// *Action: Administrator should set SQLNET_ALLOWED_LOGON_VERSION parameter
// on both client and servers to values that matches the minimum
// version supported in the system.
[oracle@orcltest ~]$
12c下:
oracle@HQsPSL-PSCV-R02:/oracle/app/oracle> oerr ora 28040
// *Cause: There was no acceptable authentication protocol for
// either client or server.
// *Action: The administrator should set the values of the
// SQLNET.ALLOWED_LOGON_VERSION_SERVER and
// SQLNET.ALLOWED_LOGON_VERSION_CLIENT parameters, on both the
// client and on the server, to values that match the minimum
// version software supported in the system.
// This error is also raised when the client is authenticating to
// a user account which was created without a verifier suitable for
// the client software version. In this situation, that account's
// password must be reset, in order for the required verifier to
可以看到,該參數在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檔案,那麼就建立一個),修改為如下的行:
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
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。
特别需要注意:
(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代替。如果繼續使用該參數,會在告警日志中無窮無盡的報“Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter.”,如下所示:
注:本地jdk版本為1.6,則下載下傳ojdbc6.jar;jdk版本為1.7,則下載下傳ojdbc7.jar
如下圖所示:
也可以在在ORACLE安裝目錄lib庫目錄下載下傳ojdbc7.jar包,然後把這個ojdbc7.jar加載到開發環境中。
[oracle@orcltest dbhome_1]$ ll $ORACLE_HOME/jdbc/lib/ojdbc*
-rw-r--r-- 1 oracle oinstall 3447295 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5dms_g.jar
-rw-r--r-- 1 oracle oinstall 2617019 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5dms.jar
-rw-r--r-- 1 oracle oinstall 3425922 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5_g.jar
-rw-r--r-- 1 oracle oinstall 2095661 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5.jar
-rw-r--r-- 1 oracle oinstall 4486070 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6dms_g.jar
-rw-r--r-- 1 oracle oinstall 3327656 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6dms.jar
-rw-r--r-- 1 oracle oinstall 4462913 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6_g.jar
-rw-r--r-- 1 oracle oinstall 2714016 Aug 23 2011 /u02/app/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6.jar
[oracle@orcltest dbhome_1]$
有關該問題,MOS上有很多文檔可以供參考。
<a>http://docs.oracle.com/database/121/UPGRD/deprecated.htm#UPGRD60010</a>
<a>https://docs.oracle.com/database/121/UPGRD/deprecated.htm#BABEDDGA</a>
小麥苗有7、8、9、10、11、12c的資料庫,是以順便模拟一下這個錯誤。
服務端為12c的資料庫,用戶端為9i,我們在用戶端嘗試連接配接12c的資料庫:
Microsoft Windows [版本 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
D:\Users\xiaomaimiao>set ORACLE_HOME=D:\Program_files\u01\app\oracle\product\ora92
D:\Users\xiaomaimiao>set ora
ORACLE10G=D:\Program files\app\oracle\product\10.2.0\db_1
ORACLE11G=D:\Program_files\u01\app\oracle\product\11.2.0.1\dbhome_1
ORACLE8I=D:\Program files\app\oracle\product\ora8i
ORACLE_HOME=D:\Program_files\u01\app\oracle\product\ora92
D:\Users\xiaomaimiao>cd %ORACLE_HOME%/bin
D:\Program_files\u01\app\oracle\product\ora92\bin>sqlplus -v
SQL*Plus: Release 9.2.0.1.0 - Production
D:\Program_files\u01\app\oracle\product\ora92\bin>tnsping ora12c
TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0 - Production on 19-DEC-2016 17:44:59
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
D:\Program_files\u01\app\oracle\product\ora92\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.128)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = lhrdb12c)))
OK (10 msec)
D:\Program_files\u01\app\oracle\product\ora92\bin>sqlplus lhr/lhr@ora12c
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 19 17:45:07 2016
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
ERROR:
ORA-28040: No matching authentication protocol
Enter user-name:
可以看到報ORA-28040: No matching authentication protocol的錯誤。
我們在服務端的$ORACLE_HOME/network/admin/sqlnet.ora添加如下的行:
重新嘗試連接配接:
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 19 17:51:54 2016
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
可以看到已經正常連接配接了。
如果将服務端的$ORACLE_HOME/network/admin/sqlnet.ora中的SQLNET.ALLOWED_LOGON_VERSION_SERVER=8和SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8注釋掉,而換成SQLNET.ALLOWED_LOGON_VERSION=8,如下:
SQLNET.ALLOWED_LOGON_VERSION=8
# SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
# SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
嘗試連接配接資料庫:
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 19 17:56:29 2016
可以正常連接配接,但是檢視告警日志的時候有如下的輸出:Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter. 而且,每連接配接一次資料庫就輸出一行該資料,和我們之前分析的問題是一緻的。
由于客戶的環境是12c Linux的,而自己沒有12c的Linux環境,安裝較為麻煩,索性就安裝了一個Windows版本的。結果執行oerr ora 的時候報錯了:
C:\Users\xiaomaimiao>oerr ora 10041
oerr: Cannot access the message file E:\app\oracle\product\12.1.0\dbhome_1\rdbms\mesg\oraus.msg
No such file or directory
C:\Users\xiaomaimiao>oerr ora 01555
oerr: Cannot access the message file E:\app\oracle\product\12.1.0\dbhome_1\rdbms\mesg\oraus.msg
經檢視報錯的檔案(E:\app\oracle\product\12.1.0\dbhome_1\rdbms\mesg\oraus.msg)的确沒有,而且任何*.msg檔案都不存在,那就從12c的Linux下把相關的$ORACLE_HOME/rdbms/mesg/*.msg檔案都拷貝到Windows的環境下:
[oracle@orcltest mesg]$ pwd
/u02/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg
[oracle@orcltest mesg]$ ll *.msg
-rw-r--r-- 1 oracle oinstall 4070 Jul 25 2008 amduus.msg
-rw-r--r-- 1 oracle oinstall 6298 Apr 14 2011 asmcmdus.msg
-rw-r--r-- 1 oracle oinstall 5886 Aug 3 2007 dbvus.msg
-rw-r--r-- 1 oracle oinstall 23309 Jan 28 2010 dgmus.msg
-rw-r--r-- 1 oracle oinstall 175881 May 11 2011 diaus.msg
-rw-r--r-- 1 oracle oinstall 49483 Jan 28 2010 expus.msg
-rw-r--r-- 1 oracle oinstall 15148 Nov 8 2009 gimus.msg
-rw-r--r-- 1 oracle oinstall 47609 Feb 18 2009 impus.msg
-rw-r--r-- 1 oracle oinstall 3585 Nov 3 2009 kfedus.msg
-rw-r--r-- 1 oracle oinstall 3457 Nov 6 2008 kfodus.msg
-rw-r--r-- 1 oracle oinstall 1792 Mar 1 2009 kfsgus.msg
-rw-r--r-- 1 oracle oinstall 26775 Nov 1 1999 kgpus.msg
-rw-r--r-- 1 oracle oinstall 3113 Sep 3 1997 kopus.msg
-rw-r--r-- 1 oracle oinstall 72528 Sep 17 2011 kupus.msg
-rw-r--r-- 1 oracle oinstall 4651 Sep 3 1997 lcdus.msg
-rw-r--r-- 1 oracle oinstall 22043 Nov 27 2006 nidus.msg
-rw-r--r-- 1 oracle oinstall 129827 May 5 2011 ocius.msg
-rw-r--r-- 1 oracle oinstall 734 Mar 8 2010 opwus.msg
-rw-r--r-- 1 oracle oinstall 4922454 Sep 17 2011 oraus.msg
-rw-r--r-- 1 oracle oinstall 178311 Aug 25 2009 qsmus.msg
-rw-r--r-- 1 oracle oinstall 391272 Sep 17 2011 rmanus.msg
-rw-r--r-- 1 oracle oinstall 40078 Jul 30 2001 sbtus.msg
-rw-r--r-- 1 oracle oinstall 123863 May 22 2010 smgus.msg
-rw-r--r-- 1 oracle oinstall 20433 Jan 13 2010 udeus.msg
-rw-r--r-- 1 oracle oinstall 20572 Jan 13 2010 udius.msg
-rw-r--r-- 1 oracle oinstall 143025 Jul 27 2009 ulus.msg
[oracle@orcltest mesg]$
然後執行就OK了。
01555, 00000, "snapshot too old: rollback segment number %s with name \"%s\" too small"
// *Cause: rollback records needed by a reader for consistent read are
// overwritten by other writers
// *Action: If in Automatic Undo Management mode, increase undo_retention
// setting. Otherwise, use larger rollback segments
本文轉自lhrbest 51CTO部落格,原文連結:http://blog.51cto.com/lhrbest/1885958,如需轉載請自行聯系原作者