How to Connect to Oracle Database?

In this tutorial, you’ll learn how to use SQL*plus and SQL developer tools to connect to an Oracle database server.

Using SQL*Plus

When you install Oracle Database Server or Client, SQLPlus is an interactive query tool that is installed automatically. SQL*Plus includes a command-line interface that allows you to connect to an Oracle Database server and run interactive statements.

If you’ve dealt with MySQL or PostgreSQL before, SQLplus is identical to MySQL’s mysql software and PostgreSQL’s psql. The sqlplus command is used to start the SQLPlus application from a Linux or Windows terminal:


On Windows, the SQL*Plus software can also be found in the Programs folder of the Start Menu.

The SQLPlus icon will request you for your account and password when you run it. Enter the username and password you chose during the Oracle Database Server installation. Ask your Database Administrator if you’re not sure which account to use.

If you want to connect to the local Oracle Database Server with the sys account, type the following:

Enter user-name: sys as sysdba
Enter password:
Code language: SQL (Structured Query Language) (sql)

You should see a notice followed by the SQL> command line after pressing enter:


It signifies you’ve established a connection with the Oracle Database Server.

When you connect to the Database Server in Oracle 12c, the default database is the ROOT container database (named CDB$ROOT). The SHOW command is used to display the database name:

SQL> SHOW con_name;

To switch to a pluggable database, use the ALTER SESSION statement to change the current database to a pluggable database, such as PDBORDL:


You’ve now established a connection to the PDBORCL database.

The EXIT command is used to disconnect a user from the Oracle Database Server:


Enter the following command to connect the OT user to the sample database in the PDBORCL pluggable database:

>sqlplus [email protected]

The OT user’s password is requested by SQL*Plus. You will be linked to the PDBORCL database on the Oracle Database Server after entering the password.

%d bloggers like this: