How to Connect to Oracle Database Server (2024)

Summary: in this tutorial, you will learn how to connect to Oracle database server using SQL*plus and SQL developer tools.

Connect to Oracle Database Server using SQL*Plus

SQL*Plus is an interactive query tool installed automatically when you install Oracle Database Server or Client. SQL*Plus has a command-line interface that allows you to connect to the Oracle Database server and execute statements interactively.

If you have worked with MySQL or PostgreSQL, SQL*plus is similar to the mysql program in MySQL or psql in PostgreSQL.

If you have worked with MySQL or PostgreSQL, SQL*plus is similar to mysql program in MySQL or psql in PostgreSQL.

To launch the SQL*Plus program, from the Linux or Windows terminal, you enter the sqlplus command:

sqlplusCode language: SQL (Structured Query Language) (sql)

You can also find the SQL*Plus program in the Program folder of the Start Menu on Windows as shown below:

How to Connect to Oracle Database Server (1)

When you launch the SQLPlus icon, it will prompt for a username and password. Enter the username and password that you chose during the installation of the Oracle Database Server. If you don’t know which account to use, ask your Database Administrator.

Suppose you want to connect to the local Oracle Database Server using the sys account, you enter the following information:

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

After pressing enter, you should see a message followed by the SQL> command line as follows:

SQL>_Code language: SQL (Structured Query Language) (sql)

It means that you have connected to the Oracle Database Server.

In Oracle 12c, when you connect to the Database Server, the default database is the ROOT container database with the name CDB$ROOT. To display the database name, you use the SHOW command:

SQL> SHOW con_name;CON_NAME------------------------------CDB$ROOTCode language: SQL (Structured Query Language) (sql)

If you want to switch to a pluggable database, use the ALTER SESSION statement to set the current database to the pluggable database e.g., PDBORDLas follows:

SQL> ALTER SESSION SET CONTAINER = PDBORCL;Session altered.Code language: SQL (Structured Query Language) (sql)

Now, you connect to the PDBORCL database.

To disconnect a user from the Oracle Database Server, you use the EXIT command:

SQL> EXITCode language: SQL (Structured Query Language) (sql)

To connect the OT user to the sample database located in the PDBORCL pluggable database, you enter the following command:

>sqlplus OT@PDBORCLCode language: SQL (Structured Query Language) (sql)

SQL*Plus prompts for the password of the OT user. Enter the password and you will be connected to the PDBORCL database in the Oracle Database Server.

Connect to Oracle Database Server using SQL Developer

SQL Developer is a free GUI tool for working with SQL in Oracle Databases. Like the SQL*Plus program, SQL Developer is installed automatically when you install the Oracle Database Server or Client.

To launch the SQL Developer program, you click the SQL Developer icon in the Oracle Program folder in Start Menu as shown in the following picture:

How to Connect to Oracle Database Server (2)

The following shows the SQL Developer program:

How to Connect to Oracle Database Server (3)

To create a new database connection, (1) first, click the New button or press Ctrl-N,and then (2) choose Database Connectionoption and click the OK button.

How to Connect to Oracle Database Server (4)

The following New / Select Database Connection dialog will display:

How to Connect to Oracle Database Server (5)

In this dialog, you need to enter the following information:

First, enter the following information:

  • A connection name. It can be any name you like, we used OT as shown in the dialog.
  • Username and its password, which is ot/Orcl1234 in this case.
  • Save the password by checking the Save Password checkbox.

Second, choose TNS as the connection type.

Third, the Network Aliaslist will be displayed after you choose the TNS connection type. Just select thePDBORCL as the network alias. By doing this, you explicitly specify the pluggable database PDBORCL to which you want to connect.

Fourth, click the Test button to test the database connection. If you see status: Successmessage, you are ready to connect to the Oracle Database Server.

To save time re-entering all the connection parameters again, click the Save button. The connection will be saved and displayed on the left side of the dialog. Whenever you want to reconnect, you just need to click the saved connection, all the parameters will be filled out automatically.

How to Connect to Oracle Database Server (6)

Now, you can click the Connect button to connect to the Oracle Database Server.How to Connect to Oracle Database Server (7)

Double click the Connections > OT > Tables, and you will see all tables in the OT sample database.

In this tutorial, you have learned how to connect to the Oracle Database Server using SQL*Plus and SQL Developer.

Was this tutorial helpful?

How to Connect to Oracle Database Server (2024)

FAQs

How to connect to an Oracle database server? ›

Accessing Oracle Database with Oracle SQL Developer
  1. Right-click Connections.
  2. Select New Connection.
  3. In the New/Select Database Connection dialog box, enter a Connection name, username, password, and for the host string, the name of the database to which you want to connect.
  4. Click Connect.

How to connect access to Oracle database? ›

Connecting Microsoft Access to Oracle Databases
  1. Open an Access database.
  2. Select “External Data”
  3. Select “from ODBC Database”
  4. Select “Link to the data source by creating a linked table”
  5. Select the “Machine Data Source” tab.
  6. Select dwprod.
  7. The Oracle ODBC Driver Connect panel will open.
  8. The following setting should exist:
Feb 6, 2018

How to connect to a specific database in Oracle? ›

When you create connections to Oracle Databases, you can connect in two ways using the Connection Type option:
  1. Basic - Specify the Host, Port, and Service Name of the database.
  2. Advanced - In the Connection String field specify the Single Client Access Name (SCAN) ID of databases running in a RAC cluster. For example:

How do users connect to an Oracle database? ›

Connecting to Oracle with Oracle Client
  1. Connection type -choose connection type (Direct or Oracle client )
  2. Host - provide a host name or address where a database is on. ...
  3. Service name - type in Oracle instance Service name.
  4. Port - type in Oracle instance port name.
  5. User and password - provide your username and password.

How do I connect to Oracle SQL server? ›

Connect to Oracle
  1. On the File menu, select Connect to Oracle. ...
  2. In the Provider box, select Oracle Client Provider or OLE DB Provider, depending on which provider is installed. ...
  3. In the Mode box, select either Standard mode, TNSNAME mode, or Connection string mode. ...
  4. If you select Standard mode, provide the following values:
Aug 1, 2023

How does a client connect to an Oracle Database? ›

To connect Oracle Database Client to an Oracle Database:
  1. From the Start menu, choose Oracle - HOME_NAME, then Configuration and Migration Tools, then Oracle Net Configuration Assistant.
  2. In the Welcome window, select Local Net Service Name configuration and click Next.

How to connect access database to server? ›

How to Connect MS Access to SQL Server
  1. Step 1: Create an ODBC database. Go to Control Panel. Change View by => Category to Small Icons. Click on Administrative Tools. ...
  2. Step 2: Connect to MS Access to database. Open MS Access. Save the MS Access file. Go to External Data in the toolbar.
Feb 11, 2020

What tool to use to connect to an Oracle Database? ›

SQL*Plus is a command-line interface used to enter SQL commands. SQL*Plus connects to an Oracle database.

How to check connectivity to Oracle Database? ›

15.1 Testing the Network
  1. Start Oracle Net Manager. See Also: ...
  2. In the navigator, expand Directory or Local, and then select Service Naming.
  3. Select the network service name or database service.
  4. Choose Command, and then select Test Net Service. ...
  5. Click Close to close the Connect Test dialog box.

How do I connect my database? ›

How to Create a Database Connection?
  1. Import the database.
  2. Load and register drivers.
  3. Create a connection.
  4. Create a statement.
  5. Execute the query.
  6. Process the results.
  7. Close the connection.
Dec 15, 2021

How to connect to Oracle Database via SQLplus? ›

Connect to the Oracle Database instance using SQL*Plus.
  1. Step 1: Open a Command Window. Take the necessary action on your platform to open a window into which you can enter operating system commands.
  2. Step 2: Set Operating System Environment Variables. ...
  3. Step 3: Start SQL*Plus. ...
  4. Step 4: Submit the SQL*Plus CONNECT Command.

How do I login to Oracle? ›

Go to https://app.oracleinfinity.com if your data center is located in North America, or https://app.eu1.oracleinfinity.com/ if your data center is located in Europe. You'll be redirected to the Oracle IDCS sign in page. Enter your user name and click Sign In. You'll be redirected to the password screen.

How do I connect to my Oracle database? ›

To connect to Oracle Database from SQL*Plus:
  1. If you are on a Windows system, display a Windows command prompt.
  2. At the command prompt, type sqlplus and then press the key Enter.
  3. At the user name prompt, type your user name and then press the key Enter.

How to link access to Oracle? ›

Open your Microsoft Access database. Select the External Data tab in the ribbon. Expand the New Data Source drop-down and select From Other Sources, then select ODBC Dababase. In the Get External Data - ODBC Database dialog box, select Link to the data source by creating a linked table.

How to connect to Oracle database using connect command? ›

Connecting Locally with the SQL Command Line
  1. Do one of the following: On Windows: Click Start, point to Programs (or All Programs), point to Oracle Database 11g Express Edition, and then select Run SQL Command Line. ...
  2. At the SQL Command Line prompt, enter the following command: CONNECT username/password.

How to connect to Oracle Database using IP address? ›

Enable Database Access Through Port 1521
  1. In Oracle Cloud Infrastructure Console, click. ...
  2. Click OCI Classic Services. ...
  3. Select the database you want to connect to.
  4. Click the Manage service icon and select Access Rules.
  5. For port 1521, click Actions and select Enable to enable the port for the default Oracle listener.

How to connect to a database remotely in Oracle? ›

Connecting Remotely to the Database by Using Oracle SQL Developer
  1. Open SQL Developer. Right-click Connections and select New Connection. ...
  2. Provide the following information and then click Test. Connection Name: Create a name for this connection. ...
  3. If your test results show success, click Connect.

How to connect to Oracle VM server? ›

Logging In to Oracle VM Manager

To open the Login page of Oracle VM Manager, enter either of the following addresses in a Web browser: For local access: http[s]://127.0. 0.1:port/OVS. For remote access: http[s]://hostname:port/OVS.

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Fredrick Kertzmann

Last Updated:

Views: 5677

Rating: 4.6 / 5 (66 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Fredrick Kertzmann

Birthday: 2000-04-29

Address: Apt. 203 613 Huels Gateway, Ralphtown, LA 40204

Phone: +2135150832870

Job: Regional Design Producer

Hobby: Nordic skating, Lacemaking, Mountain biking, Rowing, Gardening, Water sports, role-playing games

Introduction: My name is Fredrick Kertzmann, I am a gleaming, encouraging, inexpensive, thankful, tender, quaint, precious person who loves writing and wants to share my knowledge and understanding with you.