Expire Oracle User Password in Few Minutes Using Profile Resouces PASSWORD_LIFE_TIME and PASSWORD_GRACE_TIME

Values for the parameters PASSWORD_LIFE_TIME and PASSWORD_GRACE_TIME can be in number of days or can be in hours or minutes. You can specify the hours or minuts in decimal values.

In below mentioned example I am going to expire the login in 4 minutes (2 mins PASSWORD_LIFE_TIME and 2 mins PASSWORD_GRACE_TIME). In this example I mentioned a number 1440 which is equivalent for 24hr*60Min*1day.


Step 1. Create a New profile

SQL> CREATE PROFILE TEST
LIMIT PASSWORD_REUSE_MAX 10
     PASSWORD_REUSE_TIME 30
LIMIT PASSWORD_LIFE_TIME 2/1440;

Profile created.

Step 2. Assign the new profile to the user

SQL> set time on
01:32:48 SQL>  ALTER USER SCOTT PROFILE TEST;

User altered.
01:59:17 SQL> ALTER PROFILE TEST LIMIT PASSWORD_LIFE_TIME 2/1440;

Profile altered.

01:59:21 SQL> connect scott@testdb
Enter password:
ERROR:
ORA-28011: the account will expire soon; change your password now


Connected.

Now the user is running on grace time and I am going to change the grace time also to 2 mins.

02:04:12 SQL> ALTER PROFILE TEST LIMIT PASSWORD_GRACE_TIME 2/1440;

Profile altered.

02:04:36 SQL> connect scott@testdb
Enter password:
ERROR:
ORA-28002: the password will expire within 0 days


Connected.

02:06:39 SQL> connect scott@testdb
Enter password:
ERROR:
ORA-28001: the password has expired


Changing password for scott
New password:

After 2 minutes of grace time the password got expired and asking for new password.
DBA Tips Data Pump Reference

0 comments:

Post a Comment

 

dba topics. Copyright 2011-16 All Rights Reserved | Site Map | Contact | Disclaimer | Google