ALTER USER的REPLACE语句

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: Release 10.2.0.4.0 - Production on 星期一 9 13 22:56:31 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


连接到:
Oracle Database 10g Enterprise Edition Release 10.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;

用户已更改。

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4227/viewspace-673796/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/4227/viewspace-673796/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值