This post will provide a procedure to reset the Oracle user password after expiry.
How to Reset Oracle User Password After Expiry?
To reset the Oracle user password after expiry, login to the database as “SYSDBA” by typing the following command:
In the above command, “root1234” is the password of the “SYS” user.
Output
The output shows that the user has been logged in.
Unlock User Account
The “ALTER USER” clause with “ACCOUNT UNLOCK” can be utilized to unlock the user’s account after the login as an “SYSDBA”:
In the above statement, “C##DANI” is the username.
Output
The output depicts that the user has been altered.
Reset User Password
The password of the Oracle database user can be changed using the “ALTER” command. The example is given below:
In the above example, “dani321” is the new password that is used with “IDENTIFIED BY”.
Output
The output “User altered” showed that the user’s password has been changed.
Enforcing Password Expiration
Use the “PASSWORD EXPIRE” clause with the “ALTER” command to force the user to change their password after the next login. The command to do that is given below:
Output
The output depicts that the user has been altered.
Let’s confirm if the user’s password has been changed or not by logging into the user’s account. The command to log in to the “C##DANI” user is given below:
Output
The output demonstrates that upon logging in, the password set by “SYSDBA” expired and the user was asked to specify a new one.
Alternatively, the following statement can be used to change the user’s password after expiry, unlock the user’s account and force the user to change the password after the next login in a single statement:
In the above statement, “dani1234” is the user’s new password.
Output
The output showed that the specified alterations were made successfully.
Conclusion
To reset the Oracle user password after the expiry, login to the database as an “SYSDBA”. Then use the “ALTER” statement with “ACCOUNT UNLOCK” to unlock the user account. The “IDENTIFIED BY” clause can be used to reset the user’s password. Use the “PASSWORD EXPIRE” to force the user to change the password after the next login. This guide has explained how to reset the Oracle user password after expiry.