Limiting db user password to 3 days

oracle-11gsqlplus

Can any one help me with this query?

I want to change expiry date for db user to 3 days from current date, but I am not getting the query for the same.

I have installed Oracle Express 11g, it is sqlplus.

Best Answer

First, create a password policy (profile) that captures your time period. Then assign that profile to the user.

CREATE PROFILE SHORT_LIFE_PROFILE LIMIT
    PASSWORD_LIFE_TIME 3 
    PASSWORD_GRACE_TIME 1/24;

ALTER USER rdj7 PROFILE SHORT_LIFE_PROFILE;

The password grace time is the number of days the user receives a "soft warning" saying their password will soon expire. During that period, they can still log in with the old password. After that time runs out, the password has expired and they are done. In this case, I've set that to 1 hour.

See the oracle docs for other parameters you can set in this profile.