SQL Command Line is Oracle's text-based client for running SQL and SQL*Plus commands against an Oracle database, and the way to get it is to install Oracle Database (or Oracle Client) so that the sqlplus or sql executable lands on your machine, then launch it from a terminal and connect with a username and password. There is no separate "SQL Command Line" download for most versions of Oracle Database: it ships with the database software itself. The steps below walk through finding the executable, opening a session, connecting for the first time, and fixing the most common startup problems.
One note before you start: menu labels, folder names and even the tool's name have shifted across Oracle releases. In recent versions the classic client is invoked as sqlplus, while the newer SQLcl tool uses the sql command. Where a step depends on your exact install, this guide says so rather than guessing.
What You'll Need
- A computer running Windows, macOS or Linux, with an account that can install software or at least run an existing install.
- Oracle Database or Oracle Instant Client already installed, or installer media you are licensed to use. Both are downloaded only from Oracle's official website.
- Connection details for the database: host name or IP, port (commonly 1521 for the standard listener), service name or SID, plus a username and password.
- A terminal or command prompt. On Windows this is Command Prompt or PowerShell; on macOS and Linux it is Terminal.
- Administrator or sudo rights if you need to set environment variables system-wide.
Step-by-Step
- Confirm the client is installed. Open a terminal and run
sqlplus -V(orsql -Vfor SQLcl). A version banner means you are done with installation and can skip to connecting. A "command not found" or "not recognized" message means it is either missing or not on your PATH. - Install the software if needed. For a full database, run the Oracle Database installer for your platform and accept the default components, which include the SQL*Plus client. For a lightweight client-only setup, install Oracle Instant Client Basic plus the SQL*Plus package from Oracle's download page, then unzip it to a folder such as
C:\oracle\instantclient. - Add the client folder to your PATH. On Windows, open System Properties, go to Environment Variables, and add or edit the
Pathentry to include the folder containingsqlplus.exe. On macOS or Linux, add a line such asexport PATH=/opt/oracle/instantclient:$PATHto your shell profile (~/.bashrcor~/.zshrc) and reload it withsource ~/.bashrc. Close and reopen the terminal afterwards so the change takes effect. - Set the Oracle environment (full installs on Linux or macOS). If you installed a full database, the installer usually creates a profile script. Run
source /usr/local/bin/oraenvor the equivalent script for your install, and enter your SID or service name when prompted. This setsORACLE_HOMEandORACLE_SIDfor the session. - Start SQL Command Line. Type
sqlplusat the prompt and press Enter. With no arguments it opens and asks for credentials interactively. If you prefer a one-line launch, usesqlplus username/password@hostname:1521/servicename. - Connect. Enter your username and password, or use the connect form
CONNECT username@//host:port/serviceat the SQL prompt. On a local database you can often connect with the operating-system authentication shortcutsqlplus / as sysdbafrom an administrator account, which is useful for first-time setup. - Run a test statement. At the
SQL>prompt, typeSELECT * FROM dual;and press Enter. If you get a row back containing the letter X, your connection and client are both working. - Learn the exit and edit keys. Type
EXITorQUITto leave the session. A semicolon ends and runs a SQL statement, while a slash on its own line re-runs the last statement in the buffer.
Common Mistakes
The most frequent failure is a PATH problem: the client is installed but the terminal cannot find it, because the folder was added to the wrong environment variable or the terminal was not reopened. Second is confusing SID with service name, which produces an ORA-12505-style listener error. Third is forgetting the semicolon, which leaves the prompt stuck on a continuation line rather than executing anything.
Another common slip is running the client from an administrator prompt when the database expects a normal user session, or vice versa for OS authentication. Finally, people sometimes paste passwords containing special characters into the connection string without quoting them, which the parser misreads; connecting with the plain sqlplus username form and typing the password at the hidden prompt avoids this.
Tips
- Keep the client folder free of spaces in its path; older Oracle clients handle spaces poorly.
- Set
LINESIZEandPAGESIZEwithSET LINESIZE 200andSET PAGESIZE 100so wide query results do not wrap awkwardly. - Use
SET SQLPROMPTto make the prompt show the connected user and database, which avoids running statements against the wrong schema. - Store connection aliases in
tnsnames.oraso you can typesqlplus user@aliasinstead of the full address. - If you only need occasional queries, the Instant Client is far leaner than a full database install.
Troubleshooting
If sqlplus reports that the command is not found, check the PATH first, then confirm the executable actually exists in the install folder. On Windows, run where sqlplus; on macOS and Linux, run which sqlplus.
If you see a driver or library error such as ORA-12541 (no listener) or ORA-12154 (could not resolve the connect identifier), verify the host, port and service name, and check that the database listener is running on the server. Test basic network reachability with a ping or telnet to the port before blaming the client.
If the password is rejected, sign in through a working tool to confirm the account is not locked. If OS authentication fails on Linux, confirm your user belongs to the dba or oinstall group. If the client connects to the wrong database, check ORACLE_SID and any TNS_ADMIN setting, since a stale profile file often points to an old instance. As a last resort, reinstall only the client package; a full database reinstall is rarely needed for a client-side problem.
Frequently Asked Questions
Is SQL Command Line the same as SQL*Plus?
Effectively yes. SQL Command Line is the name Oracle used for the SQL*Plus tool, and the executable is still sqlplus. Newer bundles also include SQLcl, invoked as sql, which accepts the same basic commands.
Can I install only the command-line client without the database?
Yes. Oracle Instant Client with the SQL*Plus package gives you the client alone, which is enough to connect to a remote database.
Do I need a database running locally?
No, as long as you have a reachable remote database and valid credentials. The client is just a tool for talking to a database server.
Why does the prompt keep asking for more input?
You are probably missing the terminating semicolon or have an unclosed quote. Type a semicolon and press Enter, or clear the buffer and start again.
Where are connection settings stored?
Commonly in tnsnames.ora, found in the network admin directory of your Oracle install, or wherever TNS_ADMIN points. Edit it with a plain text editor.
Does it work over SSH or in a container?
Yes, it is a terminal tool and runs fine on a remote shell, provided the client libraries are installed in that environment.