一、修改密码
- alter user hr identified by hr;
- password/passw hr;
SYS@test>password hr
Changing password for hr
New password:
Retype new password:
Password changed
二、11g默认密码区分大小写
SYS@test>alter user hr identified by HR;
User altered.
Elapsed: 00:00:00.02
SYS@test>conn hr/hr;
ERROR:
ORA-01017: invalid username/password; logon deniedWarning: You are no longer connected to ORACLE.
主要是有参数SEC_CASE_SENSITIVE_LOGON决定的。
SYS@test>show parameter SEC_CASE_SENSITIVE_LOGON
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sec_case_sensitive_logon boolean TRUE
参数的官方解释:
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.
三、密码有效期
SYS@test>select * from dba_profiles where profile='DEFAULT';
PROFILE RESOURCE_NAME RESOURCE LIMIT
------------------------------ -------------------------------- -------- ----------------------------------------
DEFAULT COMPOSITE_LIMIT KERNEL UNLIMITED
DEFAULT SESSIONS_PER_USER KERNEL UNLIMITED
DEFAULT CPU_PER_SESSION KERNEL UNLIMITED
DEFAULT CPU_PER_CALL KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_SESSION KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_CALL KERNEL UNLIMITED
DEFAULT IDLE_TIME KERNEL UNLIMITED
DEFAULT CONNECT_TIME KERNEL UNLIMITED
DEFAULT PRIVATE_SGA KERNEL UNLIMITED
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD 10
DEFAULT PASSWORD_LIFE_TIME PASSWORD 180
DEFAULT PASSWORD_REUSE_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_REUSE_MAX PASSWORD UNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD NULL
DEFAULT PASSWORD_LOCK_TIME PASSWORD 1
DEFAULT PASSWORD_GRACE_TIME PASSWORD 7
取消限制--防止应用用户的密码过期被锁问题。
SYS@test>alter profile default limit password_life_time UNLIMITED;
Profile altered.
Elapsed: 00:00:00.04
四、强制密码复杂度
- sys用户
SYS@test>@?/rdbms/admin/utlpwdmg
Function created.
Elapsed: 00:00:00.06
Grant succeeded.
Elapsed: 00:00:00.03
Profile altered.
Elapsed: 00:00:00.02
Function created.
Elapsed: 00:00:00.01
Grant succeeded.
Elapsed: 00:00:00.02
主要是创建函数verify_function_11G,有兴趣可以看看创建脚本。
- 启用
11g --alter profile default limit password_verify_function verify_function_11g;
10g --alter profile default limit password_verify_function verify_function;
SYS@test>alter profile default limit password_verify_function verify_function_11g;
Profile altered.
Elapsed: 00:00:00.02
SYS@test>passw hr
Changing password for hr
New password:
Retype new password:
ERROR:
ORA-28003: password verification for the specified password failed
ORA-20001: Password length less than 8Password unchanged
3.禁用
alter profile default limit password_verify_function null;