转自:http://blog.itpub.net/7199859/viewspace-407069/
rlwrap工具可以解决linux下sqlplus 提供浏览历史命令行的功能,和删除先前输入错误的字母等问题
1.安装
需要readline包 这个安装光盘就有
[root@asm RedHat]# cd RPMS/
[root@asm RPMS]# rpm -Uvh readline*
warning: readline-4.3-13.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
error: Failed dependencies:
libtermcap-devel is needed by readline-devel-4.3-13.i386
Suggested resolutions:
/var/spool/up2datelibtermcap-devel-2.0.8-39.i386.rpm
[root@asm RPMS]# rpm -Uvh libtermcap-devel-2.0.8-39.i386.rpm
warning: libtermcap-devel-2.0.8-39.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:libtermcap-devel ########################################### [100%]
[root@asm RPMS]# rpm -Uvh readline*
warning: readline-4.3-13.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
package readline-4.3-13 is already installed
[root@asm RPMS]# rpm -Uvh readline-devel-4.3-13.i386.rpm
warning: readline-devel-4.3-13.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:readline-devel ########################################### [100%]
安装rlwrap包
rlwrap-0.28.tar.gz下载地址:http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@asm oracle]# tar -zxvf rlwrap-0.28.tar.gz
[root@asm oracle]# cd rlwrap-0.28
[root@asm rlwrap-0.28]# ls
aclocal.m4 bash30-005.patch ChangeLog config.h.in configure.ac distribution INSTALL Makefile.in README test tools
AUTHORS BUGS completions configure COPYING doc Makefile.am NEWS src TODO
[root@asm rlwrap-0.28]# ./configure
[root@asm rlwrap-0.28]# make
[root@asm rlwrap-0.28]# make install
[root@asm rlwrap-0.28]# rlwrap
Usage: rlwrap [options] command ...
Options:
-a[password:] --always-readline[=password:]
-b <chars> --break_chars=<chars>
-c --complete-filenames
-C <name|N> --command-name=<name|N>
-D <0|1|2> --history-no-dupes=<0|1|2>
-f <completion list> --file=<completion list>
-F <format string> --history-format=<format string>
-h --help
-H <file> --history-filename=<file>
-i --case-insensitive
-l <file> --logfile=<file>
-n --no-warnings
-P <input> --pre-given=<input>
-m[newline substitute] --multi-line[=newline substitute]
-r --remember
-v --version
-s <N> --histsize=<N> (negative: readonly)
bug reports, suggestions, updates:
http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@asm rlwrap-0.28]# vi /home/oracle/.bash_profile 加入下面两句
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'