How to Change the Oracle Database Password?
Select a secure password and implementing complex password policies are by far the most important defense for protecting against password-based security threats in any database. Here are several methods for changing or resetting the password for an Oracle database. We can change the Oracle database password using two different methods:
- By using ALTER USER command in the oracle database.
- By using the PASSWORD command in the command prompt.
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 geeks123.
2. Use alter user command and specify the new password for your user
ALTER USER user_name IDENTIFIED BY new_password ;
Here ‘system’ is a username and now the new password for ‘system’ becomes ‘Newgeeks123’ it means ‘system’ is now identified by password Newgeeks123. The password is changed from geeks123 to Newgeeks123.
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 (geeks123) it will show an invalid credential as shown below, it will log in successfully when login with a new password (Newgeeks123.)
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.
Attention reader! Don’t stop learning now. Learn SQL for interviews using SQL Course by GeeksforGeeks.