在Linux平台下,想在Oracle数据库的SQL*PLUS的命令行提示符下,利用键盘上的上下箭头,调出历史执行的SQL命令,可以考虑采用rlwrap这一开源工具。
现,简单记录一下安装过程(Red Hat Enterprise Linux as 5.4环境)。以前在4版本的操作系统上安装时很顺利,就不再记录。
①解压并安装rlwrap工具:
[root@server1 ~]# tar -zxvf rlwrap-0.30.tar.gz ....... ....... [root@server1 ~]# cd rlwrap-0.30 && ll total 464 -rw-rw-r-- 1 hekan hekan 32266 Jan 8 2008 aclocal.m4 -rw-r--r-- 1 hekan hekan 638 Aug 15 2006 AUTHORS -rw-r--r-- 1 hekan hekan 4740 Nov 10 2007 BUGS -rw-r--r-- 1 hekan hekan 105 Aug 10 2003 ChangeLog drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 completions -rw-rw-r-- 1 hekan hekan 5489 Jan 8 2008 config.h.in -rwxr-xr-x 1 hekan hekan 217282 Jan 8 2008 configure -rw-r--r-- 1 hekan hekan 9860 Jan 8 2008 configure.ac -rw-r--r-- 1 hekan hekan 17992 Aug 8 2006 COPYING drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 distribution drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 doc -rw-r--r-- 1 hekan hekan 1927 Nov 10 2007 INSTALL -rw-r--r-- 1 hekan hekan 436 Nov 10 2007 Makefile.am -rw-rw-r-- 1 hekan hekan 22987 Jan 8 2008 Makefile.in -rw-r--r-- 1 hekan hekan 11187 Jan 3 2008 NEWS -rw-r--r-- 1 hekan hekan 2745 Nov 10 2007 README drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 src drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 test -rw-r--r-- 1 hekan hekan 480 Nov 10 2007 TODO drwxrwxrwx 2 hekan hekan 4096 Jan 8 2008 tools [root@server1 rlwrap-0.30]# ./configure ...... checking for tgetent... no checking for tgetent in -lcurses... no checking for tgetent in -lncurses... no checking for tgetent in -ltermcap... no configure: WARNING: No termcap nor curses library found checking for readline in -lreadline... no configure: error: You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build this program! [root@server1 rlwrap-0.30]#
报错!提示需要安装readline-devel-5.1-1.1.i386.rpm包。
② 安装readline-devel-5.1-1.1.i386.rpm 包:
[root@server1 ~]# rpm -ivh readline-devel-5.1-1.1.i386.rpm warning: readline-devel-5.1-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies: libtermcap-devel is needed by readline-devel-5.1-1.1.i386 [root@server1 ~]#
又报错提示缺失libtermcap-devel包!
继续安装:
[root@server1 ~]# rpm -ivh libtermcap-devel-2.0.8-46.1.i386.rpm warning: libtermcap-devel-2.0.8-46.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:libtermcap-devel ########################################### [100%] [root@server1 ~]# rpm -ivh readline-devel-5.1-1.1.i386.rpm warning: readline-devel-5.1-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:readline-devel ########################################### [100%] [root@server1 ~]# cd rlwrap-0.30 [root@server1 rlwrap-0.30]# ./configure checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes ............ ............ configure: creating ./config.status config.status: creating Makefile config.status: creating doc/Makefile config.status: creating src/Makefile config.status: creating doc/rlwrap.man config.status: creating distribution/rlwrap.spec config.status: creating config.h config.status: executing depfiles commands Now do: make (or gmake) to build rlwrap make check for instructions how to test it make install to install it [root@server1 rlwrap-0.30]#
③ 根据执行执行,make,make install:
[root@server1 rlwrap-0.30]# make make all-recursive ...... [root@server1 rlwrap-0.30]# make install Making install in doc ...... make[2]: Leaving directory `/root/rlwrap-0.30' make[1]: Leaving directory `/root/rlwrap-0.30' [root@server1 rlwrap-0.30]#
④ 修改oracle 用户的配置文件,
[oracle@server1 ~]$ pwd /home/oracle [oracle@server1 ~]$ vi .bash_profile
在其中,添加类似配置信息:
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工具包。
评论 (1)
hello| 2011年11月2日
好工具!