0%

oracle sqlcl 設定

 

先到官網下載然後解壓即可

1
2
3
cd ~
wget https://download.oracle.com/otn_software/java/sqldeveloper/sqlcl-24.2.0.180.1721.zip
unzip sqlcl-24.2.0.180.1721.zip

接著設定 alias

1
2
3
vim ~/.bash_aliases
alias sql="${HOME}/sqlcl/bin/sql"
source ~/.bash_aliases

測試登入

1
2
sql testuser1/testuser1@localhost:1521
sql sys@localhost:1521 as sysdba

登入想要直接開 vi or emacs 模式或其他設定可以參考這篇 或是 這篇

先建一個 ~/sqlcl/bin/login.sql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
set sqlformat ansiconsole

set highlighting on
set highlighting keyword foreground blue
set highlighting identifier foreground magenta
set highlighting string foreground green
set highlighting number foreground cyan
set highlighting comment foreground yellow

set statusbar add timing
set statusbar on
set editor emacs

set serveroutput on

然後設定環境變數 SQLPATH 指向 sqlcl 安裝位置

1
2
3
vim ~/.bashrc
export SQLPATH=${HOME}/sqlcl/bin
source ~/.bashrc
關閉