怎么允许特定版本的client 登陆到database中
来源于:
How to Allow Login to Database Based on the Client Version (文档 ID 402193.1)
适用于:
Oracle Net Services - Version 10.1.0.2 to 12.1.0.2 [Release 10.1 to 12.1]
Information in this document applies to any platform.
目标:
本文的目的是怎么定义一个能连接到database中的最小版本的oracle client。通过指定允许的最小版本,可以限制数据库的访问。
如果一个client不满足或者超过了版本指定,client连接会被拒绝,报错为ora-28040
解决方案:
在sqlnet.ora文件中使用SQLNET.ALLOWED_LOGON_VERSION参数来只指定哪个身份验证协议被client 或者database 允许。
该参数定义了能连接到database中的最小版本的oracle client。该参数从Oracle database 10g中被引入,并取代了init.ora中的参数DB_ALLOWED_LOGON_VERSION
语法:
SQLNET.ALLOWED_LOGON_VERSION = n
默认值为8
允许的值如下:
11 ---对database 11g和database 10g。注意11g和10g 共享了同样的身份验证协议。因此11g的设置允许从10g client登陆
10 --- database 11g和database 10g身份验证协议
9 ---Oracle 9i和更新的身份验证协议
8 ---Oracle 8i和更新的身份验证协议
例子1:
在server端的sqlnet.ora文件中有如下:
SQLNET.ALLOWED_LOGON_VERSION = 9
Version 9 和更新的版本被运行登陆到database中,也就是说:以上参数允许9i、10g、11版本去连接db。8i的client连接db时会报:'ORA-28040: No matching authentication protocol'
例子2:
在server端的sqlnet.ora文件中有如下:
SQLNET.ALLOWED_LOGON_VERSION = 10
上面的参数允许10g 和11g client 连接数据库,oracle 9i和8i 访问数据库时遇到ORA-28040
请注意:当你设置该参数为11时,应该特别考虑,如下来自文档:
Oracle Database Net Services Reference
11g Release 1 (11.1)
The following excerpt is taken from this reference:
"Note the following implications of setting the value to 11:
To take advantage of the password protections introduced in Oracle Database 11g,
users must change their passwords so that old password verifiers are purged from the system.
Releases of OCI clients before Oracle Database 10g and all versions of JDBC thin clients
cannot authenticate to the Oracle database using password-based authentication."
请注意:该参数在oracle database 12c中已经有所改变
The SQLNET.ALLOWED_LOGON_VERSION parameter is deprecated in Oracle Database 12c.
This parameter has been replaced with two new Oracle Net Services parameters:
SQLNET.ALLOWED_LOGON_VERSION_SERVER
SQLNET.ALLOWED_LOGON_VERSION_CLIENT
See Oracle Database Net Services Reference for information