Default username and password for Oracle database

  • Post author:
  • Post category:DBA
  • Post last modified:September 6, 2023

In this blog post, we will show you how to find out the default credentials and how to change them for security reasons. The latest version of Oracle Database Enterprise Edition. Oracle 21c is a powerful and scalable database that offers many features and enhancements for data management, analytics, security, and performance.

If you are using Oracle Database 21c, you might be wondering what are the default username and password for logging in and connecting to your database. When installing Oracle 21c, the system creates some default logins and prompts you for associated passwords. Some of the default login usernames created are:

  • SYS: This is the most powerful user in Oracle Database. It has full access to all data and structures in the database and can perform any administrative task.
  • SYSTEM: This is another administrative user that has many privileges, but not as many as SYS. It can create and manage users, roles, profiles, and tablespaces.
  • HR: This is a sample user that owns the Human Resources (HR) schema, which contains tables and views for employee data. It is used for demonstration purposes and learning SQL.

1- Oracle Database Store Default Passwords

The installation process prompts for the default passwords of these users and displays them in messages. You can also find them in a file called dbca.rsp in the $ORACLE_HOME/assistants/dbca directory.

To connect to a database, you need a username and password that identify you as an authorized user of the database schema. The database administrator (DBA) is responsible for creating your database account with the necessary privileges and giving you the username and password that enables you to access your account.

2- Connect to Oracle Database

To use SQL*Plus, you need to start it from a terminal window and enter your username and password when prompted. For example, to connect as SYS user, you can enter:

For example, to connect as SYS user, you can enter:

sqlplus sys@orcl as sysdba

how to connect oracle database from sqlplus

3- Change Account Password

Once you are connected, you can use the ALTER USER command to change your password. For example, to change the password of SYS user to a new one, you can enter:

ALTER USER account_name IDENTIFIED BY new_password;

change oracle user password

By default, all these accounts are locked and expired, except for SYS and SYSTEM. This means that they cannot be used to log in to the database until they are unlocked and their passwords are reset.

4- Unlock User Account

To unlock of an account, you can use the ALTER USER command as follows:

ALTER USER account_name ACCOUNT UNLOCK;

For example, to unlock and reset the password of HR, you can run:

ALTER USER HR ACCOUNT UNLOCK;

5- Reset Account Password

To reset account password, you can use the ALTER USER command as follows:

ALTER USER HR IDENTIFIED BY oracle;

6- Change Account Privileges

After creating a user account, you need to grant it some privileges to access and manipulate the database objects. For example, to grant JOHN the privilege to connect to the database and create tables, you can run:

  • GRANT CREATE SESSION TO JOHN;
  • GRANT CREATE TABLE TO JOHN;
  • GRANT SELECT, UPDATE ON EMPLOYEES TO SCOTT;
  • GRANT ALL ON EMPLOYEES TO SCOTT WITH GRANT OPTION;

You can repeat this process for any other user that you want to change the password. To create the setPassword.sh script in the $ORACLE_HOME/bin directory to change the passwords of multiple users at once.

Conclusion

Changing your passwords regularly is a good practice to enhance the security of your database. You should also avoid using simple or common passwords that can be easily guessed or cracked by attackers. You should use strong passwords that contain a mix of uppercase and lowercase letters, numbers, and symbols. We hope this blog post has helped you understand how to find and change the default username and password for Oracle Database 21c. If you have any questions or feedback, please leave a comment below.

Read Related Topics

Leave a Reply