database 更改 Oracle 用户密码到期日期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42644192/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change Oracle User Password Expiry Date
提问by rdj7
I have got oracle User Password Expiry date using,
我使用了 oracle 用户密码到期日期,
Select Expiry_date from USER_USERS;
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.
目前我的密码不会很快到期。我想将到期日期更改为之前的日期,以便我可以测试我的代码。
My user account password should be about to Expire. i.e. I want to get ORA-28002
ERROR.
我的用户帐户密码应该即将到期。即我想得到ORA-28002
错误。
I tried using
alter user XYZ password expire;
我尝试使用
alter user XYZ password expire;
This sets my user ACCOUNT_STATUS
to EXPIRED
state but I want it to be in EXPIRED(GRACE)
status.
这将我的用户设置ACCOUNT_STATUS
为EXPIRED
状态,但我希望它处于EXPIRED(GRACE)
状态。
Please suggest any possible method.
请提出任何可能的方法。
采纳答案by Wernfried Domscheit
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;
In order to get ACCOUNT_STATUS = EXPIRED(GRACE)
you have to logon with this user, otherwise the status does not change.
为了得到ACCOUNT_STATUS = EXPIRED(GRACE)
你必须用这个用户登录,否则状态不会改变。
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>
Then you should see it:
然后你应该看到它:
SELECT ACCOUNT_STATUS
FROM DBA_USERS
WHERE USERNAME = 'RDJ7';
ACCOUNT_STATUS
--------------------------------
EXPIRED(GRACE)
1 row selected.