Oracle11gR2--SEC_CASE_SENSITIVE_LOGON参数解析

时间:2024-05-01 19:05:48

在Oracle的11g之前的版本中密码是不区分大小写的(使用双引号强制除外)。

在Oracle的11g以及以后的版本中对此有所增强。从此密码有了大小写的区分。

这个大小写敏感特性是通过SEC_CASE_SENSITIVE_LOGON参数来控制的。

1.Oracle 11gR2官方文档解释:

http://download.oracle.com/docs/cd/E11882_01/server.112/e10820/initparams218.htm#REFRN10299

SEC_CASE_SENSITIVE_LOGON
Property Description
Parameter type Boolean
Default value true
Modifiable ALTER SYSTEM
Range of values true | false
Basic No SEC_CASE_SENSITIVE_LOGON enables or disables password case sensitivity in the database.
Values:
true
Database logon passwords are case sensitive.
false
Database logon passwords are not case sensitive.

2.测试一下

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 12 16:14:53 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options #创建用n1 密码 ni
SQL> create use n1 identified by n1;
SQL> grant connect,resource to n1; #查看sec_case_sensitive_logon 参数设置 默认是 TRUE 即开启登陆大小写敏感!
SQL> show parameter sec NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_securefile string PERMITTED
optimizer_secure_view_merging boolean TRUE
sec_case_sensitive_logon boolean TRUE
sec_max_failed_login_attempts integer 10
sec_protocol_error_further_action string CONTINUE
sec_protocol_error_trace_action string TRACE
sec_return_server_release_banner boolean FALSE
sql92_security boolean FALSE #使用大写的密码登陆 登陆失败
SQL> conn n1/N1
ERROR:
ORA-01017: invalid username/password; logon denied Warning: You are no longer connected to ORACLE.
SQL> conn / as sysdba
Connected. #动态修改系统参数 为 false 不验证大小写
SQL> alter system set sec_case_sensitive_logon = false; System altered. #再次使用大写密码登陆 成功
SQL> conn n1/N1
Connected.

3.延伸测试(sec_case_sensitive_logon 参数只是控制登陆时是否校验大小写,密码还是会进按照世纪的大小写进行存储的!)

SQL> show  parameter sec_case_sensitive_logon

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sec_case_sensitive_logon boolean FALSE #创建用户 密码包含大小写
SQL> create user test11 identified by testAbcD ; User created. SQL> grant connect to test11; Grant succeeded. #测试链接 大小写不敏感
SQL> conn test11/testabcd
Connected.
SQL> conn / as sysdba
Connected. #修改为大小写敏感
SQL> alter system set sec_case_sensitive_logon = true; System altered. #用错误的密码无法登陆
SQL> conn test11/testabcd
ERROR:
ORA-01017: invalid username/password; logon denied Warning: You are no longer connected to ORACLE. #包含大小写的密码,登陆成功!
SQL> conn test11/testAbcD
Connected.
SQL>