Windows 下的 sql*plus 使自带上下键历史记录显示的,比较方便,但是linux默认却没有这个功能,需要拓展一下才可以使用,这里就引进了需要安装的两个软件包,rlwrap以及readline。安装后,Linux下的sql*plus就可以实现上下键历史记录显示的功能了。看到网络上很多朋友都有这样的疑问,这里简单记录一下安装过程,最下面是两个包的下载地址。包括:rlwrap-0.37.tar.gz以及readline-6.2.tar.gz。
首先下载软件包:
http://download.csdn.net/detail/renfengjun/6869643
安装过程很简单,先readline再rlwrap
root用户:
tar -xzvf readline-6.2.tar.gz
cd readline-6.2
./configure
make
make install
rlwrap 过程相同
tar -xzvf rlwrap-0.37.tar.gz
cd rlwrap-0.37
./configure
make
make install
安装成功后再root用户下rlwrap 会有下面的结果
[root@rh56 ~]# rlwrap Usage: rlwrap [options] command ... Options: -a[password:] --always-readline[=password:] -A --ansi-colour-aware -b--break-chars= -c --complete-filenames -C --command-name= -D <0|1|2> --history-no-dupes=<0|1|2> -f --file= -g --forget-matching= -h --help -H --history-filename= -i --case-insensitive -I --pass-sigint-as-sigterm -l --logfile= -n --no-warnings -N --no-children -o --one-shot -O --only-cook= -p[colour] --prompt-colour[=colour] -P --pre-given= -q --quote-characters= -m[newline substitute] --multi-line[=newline substitute] -r --remember -R --renice -v --version -s --histsize= (negative: readonly) -S --substitute-prompt= -t --set-term-name= -w --wait-before-prompt= (msec, <0 : patient mode) -z --filter= bug reports, suggestions, updates: http://utopia.knoware.nl/~hlub/uck/rlwrap/
然后切换到oracle用户下,修改一下环境变量。
其实不只是sql*plus可以受益,其他需要执行命令行的工具都可以受益。
alias s='rlwrap sqlplus / as sysdba' alias adrci='rlwrap adrci' alias ggsci='rlwrap /u01/gg/ggsci' alias bbed='rlwrap $ORACLE_HOME/rdbms/lib/bbed parfile=/home/oracle/bbed/dex.par' alias rman='rlwrap rman target /'
这样就结束了,自己试试吧。