8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23ai | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Misc » Here

SQLcl : Installation

The Oracle SQL Developer Command Line (SQLcl) tool is a Java-based replacement for SQL*Plus. No need to worry about client installations. Just download the app and go. This short post describes the simple process to install SQLcl.

Related articles.


If you are doing the RPM installation, ignore this section.

SQLcl requires a Java installation. That's probably going to be present on most servers anyway, but we'll assume it's not in this case.

Installation (Zip)

We're going to install everything in our home directory, but you can put them anywhere.

# Install Java
mkdir ~/java
cd ~/java
tar -xf /tmp/OpenJDK11U-jdk_x64_linux_hotspot_11.0.13_8.tar.gz
ln -s ./j* ./latest

# Install SQLcl
cd ~
unzip -oq /tmp/sqlcl-

Installation (RPM)

If you are using Oracle Linux on the Oracle Cloud Infrastructure (OCI) platform, you can install SQLcl directly from the Oracle Yum repository.

# OL7
yum install -y java-1.8.0-openjdk sqlcl

# OL8
dnf install -y java-1.8.0-openjdk sqlcl

Use It

To start SQLcl we need to make sure the JAVA_HOME environment variable is set, then run the "sql" script. I like to create an alias called "sql", but you could also put this location into your PATH environment variable.

export JAVA_HOME=${HOME}/java/latest
alias sql="${HOME}/sqlcl/bin/sql"

Now we can run SQLcl as follows.

sql /nolog

SQLcl: Release 21.3 Production on Fri Oct 29 10:42:24 2021

Copyright (c) 1982, 2021, Oracle.  All rights reserved.



You can make connections to databases using the EZ Connect URL.

CONN scott/tiger@//myhost.example.com:1521/myservice

If you would prefer to use a "tnsnames.ora" file, you can do that too. Just set the TNS_ADMIN environment variable to the directory holding the file and it will work as expected. For example, imagine I had a "tnsnames.ora" file in my home directory with the following contents.

  (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.example.com)(PORT = 1521))
    (SERVICE_NAME = myservice)

I would do the following.

export TNS_ADMIN=${HOME}

sql scott/tiger@myservice


You can get this error if you use an unsupported version of Java.

Exception in thread "main" java.lang.UnsupportedClassVersionError: oracle/dbtools/raptor/scriptrunner/cmdline/SqlCli : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.  Program will exit.

The solution is to make sure the correct version of Java is being used. I've seen situations where the Java installation in the ORACLE_HOME has taken priority over that in the JAVA_HOME location. It's also possible the PATH environment variable can confuse matters. If you are having problems, you might want to try the following.

export JAVA_HOME=${HOME}/java/latest
export PATH=$JAVA_HOME/bin:$PATH


For more information see:

Hope this helps. Regards Tim...

Back to the Top.