ALTER USER语句有一个可选的REPLACE语句,用来在启动密码验证函数后,输入原始密码。
默认情况下,用户修改自己的密码不需要提供当前密码:
SQL> create user test identified by test;
用户已创建。
SQL> grant connect to test;
授权成功。
SQL> select * from dba_profiles;
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 UNLIMITED
DEFAULT PASSWORD_REUSE_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_REUSE_MAX PASSWORD UNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD NULL
DEFAULT PASSWORD_LOCK_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_GRACE_TIME PASSWORD UNLIMITED
已选择16行。
在另外的shell登陆:
$ sqlplus test/test
SQL*Plus: Release10.2.0.4.0 - Production on星期一9月13 22:56:31 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
连接到:
Oracle Database10gEnterprise Edition Release10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> alter user test identified by test;
用户已更改。
但是如果启用了密码验证函数:
SQL> alter profile default limit password_verify_function verify_function;
alter profile default limit password_verify_function verify_function
*
第1行出现错误:
ORA-07443:未找到函数VERIFY_FUNCTION
SQL> @?/rdbms/admin/utlpwdmg.sql
函数已创建。
配置文件已更改
SQL> alter profile default limit password_verify_function verify_function;
配置文件已更改
则用户无法直接修改密码,必须提供原始密码:
SQL> alter user test identified by test;
alter user test identified by test
*
第1行出现错误:
ORA-28221:未指定REPLACE
SQL> alter user test identified by test replace test;
alter user test identified by test replace test
*
第1行出现错误:
ORA-28003:指定口令的口令验证失败
ORA-20001: Password same as or similar to user
SQL> alter user test identified by newtestpwd replace test;
alter user test identified by newtestpwd replace test
*
第1行出现错误:
ORA-28003:指定口令的口令验证失败
ORA-20003: Password should contain at least one digit, one character and one
punctuation
SQL> alter user test identified by newtest_123 replace test;
用户已更改。
Oracle会根据输入的原始密码和新密码,依据验证函数中定义的规则,来检查密码设置是否合法。
当然用户也可以通过PASSWORD命令进行设置,不过这种方法似乎是sqlplus提供的:
SQL> password
更改TEST的口令
旧口令:
新口令:
重新键入新口令:
口令已更改
对于DBA用户修改用户密码的时候,虽然也会被密码验证函数约束,但是不需要提供原始的密码:
SQL> show user
USER为"SYS"
SQL> alter user test identified by test;
alter user test identified by test
*
第1行出现错误:
ORA-28003:指定口令的口令验证失败
ORA-20001: Password same as or similar to user
SQL> alter user test identified by new_test_1;
转自:http://space.itpub.net/4227/viewspace-673796
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9472111/viewspace-746933/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9472111/viewspace-746933/