更改Oracle用户密码有效期 [英] Change Oracle User Password Expiry Date
问题描述
我使用了oracle用户密码有效期,
I have got oracle User Password Expiry date using,
Select Expiry_date from USER_USERS;
我想在密码即将到期时发出警告消息.
I want to throw a warning message when Password is about to expire.
当前我的密码即将过期.我想将过期日期更改为以前的日期,以便可以测试我的代码.
Currently my password is not expiring soon. I want to change the Expiry date to prior date, So that I can test my code.
我的用户帐户密码应该即将过期.即我要显示ORA-28002
错误.
My user account password should be about to Expire. i.e. I want to get ORA-28002
ERROR.
我尝试使用
alter user XYZ password expire;
这会将我的用户ACCOUNT_STATUS
设置为EXPIRED
状态,但是我希望它处于EXPIRED(GRACE)
状态.
This sets my user ACCOUNT_STATUS
to EXPIRED
state but I want it to be in EXPIRED(GRACE)
status.
请提出任何可能的方法.
Please suggest any possible method.
推荐答案
您必须像这样创建新的用户配置文件(或更改现有的用户配置文件):
You have to create a new user profile (or alter an existing one) like this:
CREATE PROFILE SHORT_LIFE_PROFILE LIMIT
PASSWORD_LIFE_TIME 1/24/60/60 --> = 1 second
PASSWORD_GRACE_TIME 1/24; --> = 1 hour
ALTER USER rdj7 PROFILE SHORT_LIFE_PROFILE;
要获取ACCOUNT_STATUS = EXPIRED(GRACE)
,您必须使用该用户登录,否则状态不会更改.
In order to get ACCOUNT_STATUS = EXPIRED(GRACE)
you have to logon with this user, otherwise the status does not change.
C:\>sqlplus rdj7/*****@yourDB
SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 10 10:09:29 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-28002: the password will expire within 0 days
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning option
SQL>
然后您应该会看到它:
SELECT ACCOUNT_STATUS
FROM DBA_USERS
WHERE USERNAME = 'RDJ7';
ACCOUNT_STATUS
--------------------------------
EXPIRED(GRACE)
1 row selected.
这篇关于更改Oracle用户密码有效期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!