How to Change the Oracle Database Password?

To change the Oracle database password, you can use the ALTER USER command in the Oracle database or use the PASSWORD command in the command prompt.

Selecting a secure password and implementing complex password policies are by far the most important defenses for protecting against password-based security threats in any database.

How to Change Password of the Oracle Database

There are two methods, to change the password of the Oracle database, i.e., the the PASSWORD and the PASSWORD command. Let’s understand each of these method in detail.

Change Oracle Database Password By using ALTER USER command

1. log in to your Oracle database as you normally would. Here we log in as username system and password Beginner123.

2. Use ALTER USER command and specify the new password for your user

Syntax:

 ALTER USER  user_name IDENTIFIED BY new_password ;

Here ‘system’ is a username and now the new password for ‘system’ becomes ‘NewBeginner123’ it means ‘system’ is now identified by password NewBeginner123. The password is changed from Beginner123 to NewBeginner123.

Output:

3. You don’t need any other privileges to change your own password. The same command can be used to change the password for another user from your database, that user behaves as a proxy user. You can use that proxy user and a new set password to login into your database.

4. Now if trying to log in with an old password (Beginner123) it will show an invalid credential as shown below, it will log in successfully when login with a new password (NewBeginner123.)

Change the Oracle Database Password By using the PASSWORD command in the command prompt.

1. Open command prompt window, enter sqlplus command to login into Oracle database.

2. Enter your username and password.

3. It will show a message like connected to Oracle database and your version name as shown below.

4. Enter the password at the SQL prompt. You will be prompted for your Old password and the New password.

5. Type your Old Password and press enter. Now type a New Password and press enter.

6. Enter the New Password again and press enter. You will receive a confirmation that your password has changed for the database to which you were logged in as shown below.

Conclusion

In this guide, we learnt how to change Oracle database password with examples. We have covered two methods to change password for Oracle database. You can change password using command prompt or SQL commands. We have explained the ALTER USER command and PASSWORD command.


Contact Us