或许你不知的ORACLE秘密系列一(二)
l>ALTER USER LIU IDENTIFIEDBY VALUES'S:813731A84040EA2C4DF1545B869495ECA28C81486A11E5E19344F88BA312';
用户已更改。
SYS@orcl>CONN LIU/ABC
ERROR:
ORA-01017: invalid username/password;logon denied
警告:您不再连接到 ORACLE。
@>CONN / AS SYSDBA
已连接。
SYS@orcl>conn LIU/LIU
已连接。
LIU@orcl>
As per Metalink Note429465.1 , view DBA_USERS has new column PASSWORD_VERSIONS rendered as follows:
decode(length(u.password),16,'10G',NULL)||NVL2(u.spare4, '11G ' ,NULL)
for example:
SYS@orcl>SELECT USERNAME,PASSWORD_VERSIONSFROM DBA_USERS WHERE USERNAME='LIU';
USERNAME PASSWORD
------------------------------ --------
LIU 11G
SYS@orcl>SELECT USERNAME,PASSWORD_VERSIONSFROM DBA_USERS WHERE USERNAME IN ('SYS','DNA','LIU');
USERNAME PASSWORD
------------------------------ --------
SYS 10G 11G
DNA 10G 11G
LIU 11G
In this case it means both old andnew-style hash values are available for the users--SYS,DNA, the new hash valueis stored in the USER$.SPARE4 column, as long as this remains NULL it means thepassword has not been changed since the migration and the user will have theold case insensitive password.
SYS@orcl>CREATE USER LIU2 IDENTIFIED BYLIU2;
用户已创建。
SYS@orcl>SELECTUSERNAME,PASSWORD_VERSIONS FROM DBA_USERS WHERE USERNAME IN('SYS','DNA','LIU','LIU2');
USERNAME PASSWORD
------------------------------ --------
SYS 10G 11G
LIU 11G
LIU2 10G 11G
DNA 10G 11G
As I had reset passwordusing only spare4 string, password will be case -sensitive irrespective ofsetting for sec_case_sensitive_logon parameter value
Update
When resetting the password, we need toalso query password column from user$ column if we wish to use case-insensitivefeature in future. i.e In my above example I used only spare4 column value toreset the password. Now if I set sec_case_sensitive_logon=false , I will not beable to connect.
SYS@orcl>CONN LIU/Liu
ERROR:
ORA-01017: invalid username/password;logon denied
警告:您不再连接到 ORACLE。
@>conn LIU/LIU
已连接。
LIU@orcl>CONN / AS SYSDBA
已连接。
SYS@orcl>ALTER SYSTEM SETSEC_CASE_SENSITIVE_LOGON=FALSE;
系统已更改。
SYS@orcl>SHO PARAMETER SEC_CASE
NAME TYPE VALUE
----------------------------------------------- ------------------------------
sec_case_sensitive_logon boolean FALSE
SYS@orcl>CONN LIU/LIU
ERROR:
ORA-01017: invalid username/password;logon denied
警告:您不再连接到 ORACLE。
@>CONN LIU/liu
ERROR:
ORA-01017: invalid username/password;logon denied
In case we wish to useboth, we need to setidentified by values ‘S:spare4;password’. As I didnot usepassword field while resetting, I find that password field in user$ is empty.To correct it, I had to change the password again.
SYS@orcl>select password,spare4 fromuser$ where name='LIU';
PASSWORD
------------------------------
SPARE4
------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
S:813731A84040EA2C4DF1545B869495ECA28C81486A11E5E19344F88BA312
SYS@orcl>alter syste