Monday, July 7, 2008

Solution of ORA-28002: the password will expire within 10 days

Error Description:
-----------------------------------

Whenever a user try to connect to database it raise ORA-28002: error.

-bash-3.00$ sqlplus arju/a


SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 7 23:58:46 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

ERROR:
ORA-28002: the password will expire within 10 days


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Cause of The Problem:
-----------------------------------

Lets know the user profile.
SQL> select profile from dba_users where username='ARJU';

PROFILE
------------------------------
DEFAULT

Now lets know the resource settings 'PASSWORD_GRACE_TIME','PASSWORD_LIFE_TIME' of default profile.

SQL> select LIMIT, RESOURCE_NAME from dba_profiles where RESOURCE_NAME in ('PASSWORD_GRACE_TIME','PASSWORD_LIFE_TIME','PASSWORD_REUSE_MAX','PASSWORD_REUSE_TIME') and PROFILE=(select profile from dba_users where username='ARJU');

LIMIT RESOURCE_NAME
---------------------------------------- --------------------------------
60 PASSWORD_LIFE_TIME
1800 PASSWORD_REUSE_TIME
UNLIMITED PASSWORD_REUSE_MAX
10 PASSWORD_GRACE_TIME

The resource PASSWORD_REUSE_TIME and PASSWORD_REUSE_MAX must be set in conjunction with each other. PASSWORD_REUSE_TIME specifies the number of days before which a password cannot be reused. PASSWORD_REUSE_MAX specifies the number of password changes required before the current password can be reused.

In this case our interested resource is PASSWORD_LIFE_TIME and PASSWORD_GRACE_TIME.

The resource of Default profile PASSWORD_LIFE_TIME specify the number of days the same password can be used for authentication.

The resource PASSWORD_GRACE_TIME specify the number of days after the grace period begins during which a warning is issued and login is allowed. If the password is not changed during the grace period, the password expires.

Here in the profile of ARJU user the value of PASSWORD_GRACE_TIME is set to 10. So it just arises a warning ORA-28002 but still allow users to logon to database. The password will expire if it is not changed within the grace period, and further connections are rejected. If you do not set a value for PASSWORD_GRACE_TIME, its default of UNLIMITED will cause the database to issue a warning but let the user continue to connect indefinitely.

One may interpret wrongly of parameter PASSWORD_LIFE_TIME with account creation time. Actually the PASSWORD_LIFE_TIME limit of a profile is measured from the last time an account's password was changed or the account creation time if the password has never been changed.

The account creation time and password change time can be seen from USER$.CTIME and USER$.PTIME respectively. Like,
SQL> select ctime, ptime from sys.user$ where name='ARJU';

CTIME PTIME
--------- ---------
08-MAY-08 08-MAY-08

You can also get the account creation time from dba_users view.
SQL> SELECT CREATED FROM DBA_USERS WHERE USERNAME = 'ARJU';

CREATED
---------
08-MAY-08

Now let's look current time which is 08-JUL-08
SQL> select sysdate from dual;

SYSDATE
---------
08-JUL-08

So between the password change time and current time there it is passed 60 which is equal to PASSWORD_LIFE_TIME. Now the setting of PASSWORD_GRACE_TIME to 10 allow the user ARJU to connect to database 10 days more but will issue a warning.

Solution of The Problem:
--------------------------------------

A)Change the user password.
------------------------------------

If you just want to avoid the error temporary then change the user password.
SQL> conn arju/a
ERROR:
ORA-28002: the password will expire within 10 days
SQL> password
Changing password for ARJU
Old password:
New password:
Retype new password:
Password changed
SQL> conn arju/a!12
Connected.

Now you can see the change time by .
SQL> select ctime, ptime from sys.user$ where name='ARJU';

CTIME PTIME
--------- ---------
08-MAY-08 08-JUL-08

This is a temporary solution. After 60 days the user will again see the warning message.

B)Change PASSWORD_LIFE_TIME resource of profile assigned to user.
----------------------------------------------------------------------------------------


The permanent solution is to change PASSWORD_LIFE_TIME resource of profile DEFAULT which is assigned to user ARJU.

SQL> select profile from dba_users where username='ARJU';

PROFILE
------------------------------
DEFAULT
If you make it unlimited then user never will see above error. Like,
SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

Profile altered.

6 comments:

  1. thanks buddy...ur solution has helped me big time...very neatly documented and well explained.
    Thanks once again

    ReplyDelete
  2. Thank you for the useful info.

    ReplyDelete
  3. All the solutions you post are neatly documented,complete and logically make sense. Thank you

    ReplyDelete
  4. Great help, tks!!

    ReplyDelete
  5. I changed the password_life_time to unlimited for an 11g database profile (default is 180) and the user still get ORA-28002 error during login. Any idea why?

    ReplyDelete
  6. Any answer to this? We're seeing it also.

    ReplyDelete