在Oracle的11g之前的版本中密码是不区分大小写的(使用双引号强制除外)。在Oracle的11g版本中对此有所增强。从此密码有了大小写的区分,这个大小写敏感特性是通过SEC_CASE_SENSITIVE_LOGON参数来控制的。简单探索一下。
1.创建Secooler用户,注意它的密码同时包含大写字母和小写字母。
sys@ora11gR2> create user Secooler identified by Secooler;
User created.
sys@ora11gR2> grant connect to secooler;
Grant succeeded.
从这个授权成功上可见,用户名仍然不区分大小写。
2.尝试使用全小写的密码登陆
sys@ora11gR2> conn secooler/secooler
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
报错,显然不行,此时大小写敏感性检查已经启用。
3.使用“正确”的密码“Secooler”进行登陆,成功。
sys@ora11gR2> conn secooler/Secooler
Connected.
secooler@ora11gR2> show user;
USER is "SECOOLER"
4.看一下“幕后黑手”SEC_CASE_SENSITIVE_LOGON参数的描述
sys@secooler> show parameter sec_case_sensitive_logon
NAME TYPE VALUE
-------------------------- ---------- -----------
sec_case_sensitive_logon boolean TRUE
sys@ora11gR2> select a.ksppinm name,b.ksppstvl value,a.ksppdesc description
2 from x$ksppi a,x$ksppcv b
3 where a.indx = b.indx
4 and a.ksppinm = 'sec_case_sensitive_logon'
5 /
NAME VALUE DESCRIPTION
------------------------- ------ -----------------------------------------
sec_case_sensitive_logon TRUE case sensitive password enabled for logon
该参数默认值是“TRUE”,因此,默认情况下密码大小写是敏感的。
5.将SEC_CASE_SENSITIVE_LOGON参数修改为“FALSE”
sys@ora11gR2> alter system set sec_case_sensitive_logon = FALSE;
System altered.
6.此时系统将不对密码做大小写敏感验证
7.即使修改SEC_CASE_SENSITIVE_LOGON参数为“FALSE”,在系统中记录的也是区分大小写的形式,只是不进行验证而已。
1)创建另外一个用户sec,并授权
sys@ora11gR2> create user sec identified by SeC;
sys@ora11gR2> grant connect to sec;
2)在SEC_CASE_SENSITIVE_LOGON参数为“FALSE”时尝试连接,成功,因为此时不进行校验。
sys@ora11gR2> conn sec/sec
3)恢复SEC_CASE_SENSITIVE_LOGON参数为“TRUE”,再次尝试连接将会失败。
sec@ora11gR2> conn / as sysdba
sys@ora11gR2> alter system set sec_case_sensitive_logon = TRUE;
4)使用“正确”的密码进行尝试,成功。
sys@ora11gR2> conn sec/SeC
5)结论
11g环境中密码是以区分大小写的形式进行存储的。
8.Oracle 11g文档参考(11gR1和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:
Database logon passwords are case sensitive.
false
Database logon passwords are not case sensitive.
9.小结
11g的这个密码大小写敏感的新特性对于提升数据库的安全性有很大的帮助,同时也增加了密码的排列组合数目,从此“Secooler”和“secooler”可以作为两个不同用户的密码了。从这个小小的改动上可以看出Oracle诸多人性化改变无处不在。