How to Login to SQL*Plus in Oracle – Step-by-Step Guide

SQL*Plus is a command-line tool used to interact with Oracle databases. It’s simple, fast, and powerful. If you need to run queries or manage your database, this guide will help you log in easily.

Step 1: Open SQL*Plus

First, you need to open SQL*Plus. How you do that depends on your system:

  • Windows: Click Start, type cmd (Command Prompt), and press Enter. Then type sqlplus and hit Enter.
  • Linux/Mac: Open a terminal and type sqlplus, then press Enter.

Step 2: Enter Your Credentials

Now, you’ll need to log in with your Oracle credentials. There are different ways to do this:

1. Connecting as a Standard User

Enter your username and password like this:

  
sqlplus username/password  

Example:

  
sqlplus hr/hrpw  

This means:

  • hr is the username
  • hrpw is the password

If your credentials are correct, you’ll see a welcome message and the SQL prompt.

2. Connecting Using a Connection String

If you’re connecting to a remote database, you’ll need a connection string:

  
sqlplus username/password@hostname:port/service_name  

Example:

  
sqlplus hr/hrpw@192.168.1.100:1521/orcl  

Here:

  • 192.168.1.100 is the database server
  • 1521 is the Oracle listener port
  • orcl is the service name

3. Connecting as SYSDBA

Sometimes, you need to log in as an administrator. To do this, use:

  
sqlplus sys/password as sysdba  

Or, if you’re on the database server:

  
sqlplus / as sysdba  

This allows you to manage the database with full privileges.

Step 3: Verify the Connection

Once logged in, you should see the SQL prompt. To check the database version, run:

  
SELECT * FROM v$version;  

If everything works, you’re good to go!

Common Login Issues and Fixes

1. Invalid Username or Password

Double-check your username and password. Make sure Caps Lock isn’t on.

2. ORA-12154: TNS Could Not Resolve the Connect Identifier

  • Make sure your tnsnames.ora file is correctly configured.
  • Try connecting using the full connection string.

3. ORA-12560: TNS Protocol Adapter Error

This usually happens on Windows. Try running Command Prompt as Administrator.

Conclusion

Logging into SQL*Plus is easy once you know the steps. Whether you’re connecting as a user or an admin, the process is straightforward. Just follow this guide, and you’ll be running queries in no time!