当在Linux Shell中运行SQL*Plus的时候,并不提供浏览历史命令行的功能。相反的,在Windows操作系统上,当在DOS命令窗口中运行SQL*Plus的时候,可以使用向上,向下键来跳回之前已经执行过的SQL语句。你可以 根据需要修改他们,然后按[Enter]重新提交执行。[@more@]为了在Linux中达到同样的目的,你可以安装rlwrap,这个程式本身是个Shell,可以运行任何你提供给它的命令包括参数,并添加命令历史浏览功能。 The rlwrap program is under the GPL license。
1:安装
yum install readline-devel
wget http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.30.tar.gz
1):解压缩安装文件
[oracle@Channel-MQ3 ~]$tar zxvf rlwrap-0.28.tar
2):切换到root用户,执行下面的命令
[root@Channel-MQ3 ~]# cd /home/oracle/rlwrap-0.28
[root@Channel-MQ3 rlwrap-0.28]# ls
aclocal.m4 completions configure INSTALL README TODO
AUTHORS config.h configure.ac Makefile src tools
bash30-005.patch config.h.in COPYING Makefile.am stamp-h1
BUGS config.log distribution Makefile.in test
ChangeLog config.status doc NEWS test.log
[root@Channel-MQ3 rlwrap-0.28]#./configure
[root@Channel-MQ3 rlwrap-0.28]#make
[root@Channel-MQ3 rlwrap-0.28]#make install
安装后在Oracle用户的.bash_profile文件中加上两句话:
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
重新用Oracle用户登录或执行. /home/oracle/.bash_profile,使修改生效。下面就可以在sqlplus和rman中按想象的方式使用箭头键了。
来源:
http://hi.baidu.com/top2top/blog/item/89f966064aa40c7e0308814c.html
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9614263/viewspace-1007534/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9614263/viewspace-1007534/
本文介绍如何在Linux环境下为SQL*Plus安装命令历史浏览功能。通过安装rlwrap工具,用户可以在SQL*Plus中使用上下箭头键来查看和编辑之前的SQL命令。
422

被折叠的 条评论
为什么被折叠?



