SQL*Plus, SQLcl and SQL Developer
The Three Tools
| Tool | Type | Best for |
|---|---|---|
| SQL*Plus | Command line, on every Oracle server | Admin work, scripts, servers with no GUI |
| SQLcl | Modern command line with history and autocomplete | Daily work in the terminal |
| SQL Developer | Free graphical tool | Browsing objects, writing long SQL, visual plans |
Connecting
bash
# Easy connect: user/password@host:port/service
sqlplus system/YourStrongPwd1@localhost:1521/FREEPDB1
# On the database server as the OS user, connect as SYSDBA
sqlplus / as sysdba
# SQLcl uses the same connect string
sql system/YourStrongPwd1@localhost:1521/FREEPDB1
What is / as sysdba? On the server, the OS user who installed Oracle can log in with no password using operating system authentication. SYSDBA is the most powerful role, so use it only for admin tasks.
Where Am I?
Always check who and where you are before running a risky command:
sql
SHOW USER
SHOW CON_NAME
SELECT sys_context('USERENV','CON_NAME') AS container,
sys_context('USERENV','SESSION_USER') AS db_user
FROM dual;
Make the Output Readable
sql
SET LINESIZE 200
SET PAGESIZE 50
COLUMN name FORMAT A30
COLUMN file_name FORMAT A60
SET TIMING ON
| Command | Meaning |
|---|---|
SET LINESIZE 200 | Allow wider lines so rows do not wrap |
SET PAGESIZE 50 | Repeat the header every 50 rows |
COLUMN x FORMAT A30 | Show column x with 30 characters width |
SET TIMING ON | Print how long each command took |
Handy Commands
sql
DESC employees -- show the columns of a table
@/home/oracle/check.sql -- run a script file
SPOOL report.txt -- save output to a file
SELECT * FROM v$version;
SPOOL OFF
EXIT
Tip: Put your favorite SET commands in a file named
login.sql in your working folder. SQL*Plus runs it automatically at start.
About SQL Developer
- Create a connection with host, port 1521 and Service name
FREEPDB1. - Use the Connections tree to browse tables and users.
- Use Tools > Database Administration style panels, Explain Plan (F10) and the Run Script button (F5).
Conclusion
SQL*Plus works everywhere, SQLcl makes the terminal pleasant and SQL Developer helps you see things. Learn at least SQL*Plus because it is on every server.
Quick Summary: Connect with user/password@host:port/service. Use SHOW USER and SHOW CON_NAME before risky commands.

