This article will cover:
- How to Reset Password for the Oracle Database User With ALTER Command
- How to Reset Password for Oracle Database User With PASSWORD Command
- How to Force the Oracle Database User to Change/Modify Password in the Next Login
- How to Unlock the User’s Account While Resetting the Password in Oracle
Reset the Password for the Oracle Database User
To reset the Oracle database user password, log in to the database as a user with “System Administrative Privileges”. To do that, type the following command:
In the above command, “root1234” is the password of the “SYS” user.
Output
The output showed that a connection had been created.
How to Reset Password for the Oracle Database User With ALTER Command?
To reset the password for the Oracle database user using the “ALTER” command, use the following syntax:
In this syntax, the “USER” keyword is for the username and the “IDENTIFIED BY” keyword is for the password.
Let’s reset the “C##LINUXHINT” user’s password by using the following query:
In the above query, the “linuxhint123” is the password for the “C##LINUXHINT” user.
Output
The output showed that the password has been reset. Now, the user will be able to log in via the updated password.
Let’s log in as a “C##LINUXHINT” user with the new password. To do that, type the following command:
Output
The output showed that the user has been logged in with the new password.
How to Reset Password for Oracle Database User With PASSWORD Command?
To reset the password for the Oracle database user using the “PASSWORD” command, use the following syntax:
Let’s reset the password of the “C##LINUXHINT” user by typing the following query:
Executing the PASSWORD command will ask you to type the “New password”.
Output
The output showed that the password had been changed.
How to Force the Oracle Database User to Change/Modify Password in the Next Login?
While resetting the password, the administrator can force the Oracle database user to provide their own password at the next login. To do this, use the “PASSWORD EXPIRE” clause combined with the “ALTER” command.
The example code is given below:
In the above example, the “C##LINUXHINT” is a username, and the “linuxhint935” is the password.
Output
The output showed that the user had been altered.
To verify the working of the “EXPIRE” clause, log in with your new password:
In the above command, “linuxhint935” is the password.
Output
From the output, it is clear that the user was asked to change the password after the login.
How to Unlock the User’s Account While Resetting the Password in Oracle?
The user account can be unlocked by using the “ACCOUNT UNLOCK” statement while resetting the password with the “ALTER” command. The example is given below:
In the above command, “linuxhint123” is the password.
Output
The output depicts that the password has been reset.
Conclusion
To reset the password for the Oracle database user, log in to the database with “System Administrative Privileges” using the “SQLPLUS” command. Then reset the password using the “ALTER” or “PASSWORD” command. The administrator can force the user to change the password in the next login and unlock the user account while resetting the password. This article has explained how to reset the password for the Oracle database user using practical examples.