install SQLcl

oracle cli tool

By widehyo
  • prepare sqlcl file SQLcl

sqlcl-latest.zip cp sqlcl-latest.zip /opt

  • install
    $ cd /opt
    $ sudo unzip sqlcl-latest.zip 
    $ sudo chmod -R a+rX /opt/sqlcl
    $ /opt/sqlcl/bin/sql
    
  • check
/opt $ java -version
openjdk version "11.0.30" 2026-01-20
OpenJDK Runtime Environment (build 11.0.30+7-post-Ubuntu-1ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.30+7-post-Ubuntu-1ubuntu122.04, mixed mode, sharing)

/opt/sqlcl/bin $ sudo ./sql

SQLcl: Release 25.4 Production on Fri Mar 13 08:37:39 2026

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

Username? (''?) 

  • caution: if the user has no permission, you will see following:
/opt/sqlcl/bin $ ./sql
Error: Could not find or load main class oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli
Caused by: java.lang.ClassNotFoundException: oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli
  • solution: sudo chmod -R a+rX /opt/sqlcl

  • setting

~/.bashrc

export ORACLE_HOME=/opt/oracle/instantclient_23_26
export LD_LIBRARY_PATH=$ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME 

export PATH='/opt/sqlcl/bin':$PATH
function oevax {
   source ~/env/rc.evuser-dev
   # echo sql "$ORA_USERNAME/$ORA_PASSWORD@//$ORA_HOST:$ORA_PORT/$ORA_SERVICE_NAME"
   sql "$ORA_USERNAME/$ORA_PASSWORD@//$ORA_HOST:$ORA_PORT/$ORA_SERVICE_NAME"
}
$ source ~/.bashrc
$ oevax

/opt $ oevax

SQLcl: Release 25.4 Production on Fri Mar 13 08:46:12 2026

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 

  • register oracle connection commands

~/.bashrc

export PATH="/home/widehyo/.cli/bin:$PATH"

alias oevax='ora-connect ~/env/rc.evuser-dev'
alias oevaxexec='ora-connect ~/env/rc.evuser-dev /home/widehyo/login.sql'

/home/widehyo/.cli/bin/ora-connect

#!/bin/bash
set -eo pipefail

env_file="$1"
start_file="$2"

source "$env_file"

export SQLPATH="$PWD"

if [ $# -eq 1 ]; then
    sql "$ORA_USERNAME/$ORA_PASSWORD@//$ORA_HOST:$ORA_PORT/$ORA_SERVICE_NAME"
elif [ $# -eq 2 ]; then
    sql "$ORA_USERNAME/$ORA_PASSWORD@//$ORA_HOST:$ORA_PORT/$ORA_SERVICE_NAME" "@$start_file"
fi

/home/widehyo/login.sql

info+ table_name
exit