在Linux平台下,想在Oracle資料庫的SQL*PLUS的命令列提示符下,利用鍵盤上的上下箭頭,調出曆史執行的SQL命令,可以考慮採用rlwrap這一開源工具。
現,簡單記錄一下安裝過程(Red
Hat Enterprise Linux as 5.4環境)。以前在4版本的作業系統上安裝時很順利,就不再記錄。
①解壓並安裝rlwrap工具:
01 |
[root@server1 ~]# tar -zxvf rlwrap-0.30.tar.gz |
07 |
[root@server1 ~]# cd rlwrap-0.30 && ll |
11 |
-rw-rw-r-- 1 hekan hekan 32266 Jan 8 2008 aclocal.m4 |
13 |
-rw-r--r-- 1 hekan hekan 638 Aug 15 2006 AUTHORS |
15 |
-rw-r--r-- 1 hekan hekan 4740 Nov 10 2007 BUGS |
17 |
-rw-r--r-- 1 hekan hekan 105 Aug 10 2003 ChangeLog |
19 |
drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 completions |
21 |
-rw-rw-r-- 1 hekan hekan 5489 Jan 8 2008 config.h.in |
23 |
-rwxr-xr-x 1 hekan hekan 217282 Jan 8 2008 configure |
25 |
-rw-r--r-- 1 hekan hekan 9860 Jan 8 2008 configure.ac |
27 |
-rw-r--r-- 1 hekan hekan 17992 Aug 8 2006 COPYING |
29 |
drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 distribution |
31 |
drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 doc |
33 |
-rw-r--r-- 1 hekan hekan 1927 Nov 10 2007 INSTALL |
35 |
-rw-r--r-- 1 hekan hekan 436 Nov 10 2007 Makefile.am |
37 |
-rw-rw-r-- 1 hekan hekan 22987 Jan 8 2008 Makefile.in |
39 |
-rw-r--r-- 1 hekan hekan 11187 Jan 3 2008 NEWS |
41 |
-rw-r--r-- 1 hekan hekan 2745 Nov 10 2007 README |
43 |
drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 src |
45 |
drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 test |
47 |
-rw-r--r-- 1 hekan hekan 480 Nov 10 2007 TODO |
49 |
drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 tools |
51 |
[root@server1 rlwrap-0.30]# ./configure |
55 |
checking for tgetent... no |
57 |
checking for tgetent in -lcurses... no |
59 |
checking for tgetent in -lncurses... no |
61 |
checking for tgetent in -ltermcap... no |
63 |
configure: WARNING: No termcap nor curses library found |
65 |
checking for readline in -lreadline... no |
69 |
You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build |
73 |
[root@server1 rlwrap-0.30]# |
報錯!提示需要安裝readline-devel-5.1-1.1.i386.rpm包。
② 安裝readline-devel-5.1-1.1.i386.rpm 包:
1 |
[root@server1 ~]# rpm -ivh readline-devel-5.1-1.1.i386.rpm |
3 |
warning: readline-devel-5.1-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 |
5 |
error: Failed dependencies: |
7 |
libtermcap-devel is needed by readline-devel-5.1-1.1.i386 |
又報錯提示缺失libtermcap-devel包!
繼續安裝:
01 |
[root@server1 ~]# rpm -ivh libtermcap-devel-2.0.8-46.1.i386.rpm |
03 |
warning: libtermcap-devel-2.0.8-46.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 |
05 |
Preparing... ########################################### [100%] |
07 |
1:libtermcap-devel ########################################### [100%] |
09 |
[root@server1 ~]# rpm -ivh readline-devel-5.1-1.1.i386.rpm |
11 |
warning: readline-devel-5.1-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 |
13 |
Preparing... ########################################### [100%] |
15 |
1:readline-devel ########################################### [100%] |
17 |
[root@server1 ~]# cd rlwrap-0.30 |
19 |
[root@server1 rlwrap-0.30]# ./configure |
21 |
checking build system type... i686-pc-linux-gnu |
23 |
checking host system type... i686-pc-linux-gnu |
25 |
checking for a BSD-compatible install... /usr/bin/install-c |
27 |
checking whether build environment is sane... yes |
29 |
checking for a thread-safe mkdir -p... /bin/mkdir -p |
31 |
checking for gawk... gawk |
33 |
checking whether make sets $(MAKE)... yes |
39 |
configure: creating ./config.status |
41 |
config.status: creating Makefile |
43 |
config.status: creating doc/Makefile |
45 |
config.status: creating src/Makefile |
47 |
config.status: creating doc/rlwrap.man |
49 |
config.status: creating distribution/rlwrap.spec |
51 |
config.status: creating config.h |
53 |
config.status: executing depfiles commands |
57 |
make (or gmake) to build rlwrap |
59 |
make check for instructions how to test it |
61 |
make install to install it |
63 |
[root@server1 rlwrap-0.30]# |
③ 根據執行執行,make,make install:
01 |
[root@server1 rlwrap-0.30]# make |
07 |
[root@server1 rlwrap-0.30]# make install |
13 |
make[2]: Leaving directory `/root/rlwrap-0.30' |
15 |
make[1]: Leaving directory `/root/rlwrap-0.30' |
17 |
[root@server1 rlwrap-0.30]# |
④ 修改oracle 使用者的設定檔,
5 |
[oracle@server1 ~]$ vi .bash_profile |
在其中,添加類似配置資訊:
1 |
alias sqlplus='rlwrap sqlplus /nolog' |
⑤至此,oracle在SHELL提示符下,只需要執行sqlplus就可以進入SQL*PLUS的命令列提示符,並且可以利用鍵盤的上下箭頭調出之前執行過的曆史命令。
這是在RHEL 5.4版本的作業系統上安裝時的簡單記錄,而之前沒遇到過類似的問題,故簡單記錄之。
即先安裝libtermcap-devel-2.0.8-46.1.i386.rpm
然後安裝 readline-devel-5.1-1.1.i386.rpm
最後安裝rlwrap工具包。