在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>