How to Connect SQLPLUS to Oracle Database

Connecting methods of SQLPLUS in Oracle

To connect SQLPLUS on the operating system, several factors come into play. You can connect to the database using various methods. Sometimes, you also need to set the ORACLE_HOME and PATH environment variables to use the SQLPLUS prompt.

Note: If multiple databases are configured on one system, you must use the ORACLE_SID environment variable.

1. Connect to local database user with sysdba priviliges

sqlplus sys as sysdba

2. Connect with Operating System Authentication with SYSDBA Privilege.

sqlplus / as sysdba

3. Connect with easy connect syntax

sqlplus hr@"databasehostname.example.com:1522/orcl"

4. Connect with Easy Connect Syntax with IP address and port is default (1521).
Note: If port is default then not need to specify the port number

sqlplus hr@"172.1.1.5/orcl"

5. Connecting with an IPv6 Address
Note: IPV6 is used in Square bracket

connect hr@"[2001:0DB8:0:0::200C:417A]/orcl"

6. Connecting with a Net Service Name
Note: tnsentry in tnsnames.ora for using as net service name

connect hr@orcl

Leave a Reply