转载时请务必以超链接形式标明文章 原始出处和作者信息及本版权声明。
链接:http://www.dbasky.net/archives/2009/01/linuxrlwraplinux-shellsql.html
在Linux Shell中运行SQL*Plus的时候,并不提供浏览历史命令行的功能。相反的,在Windows操作系统上,当在DOS命令窗口中运行SQL*Plus的时候,可以使用向上,向下键来跳回之前已经执行过的SQL语句,我觉得这个功能非常的方便,如果在linux下的oracle 执行sql要实现像windows那样子的功能,可以安装一个软件rlwrap ,目前的版本是0.30,可以到官方网站下.
1:安装
rlwrap-0.30.tar.gz
1):解压缩安装文件
[oracle@dbserver ~]$gunzip rlwrap-0.30.tar.gz
[oracle@dbserver ~]$tar xvf rlwrap-0.30 .tar
2):切换到root用户,执行下面的命令
[root@dbserver ~]# cd /home/oracle/rlwrap-0.30
[root@dbserver rlwrap-0.30]# 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@dbserver rlwrap-0.30 ]#./configure --prefix=/usr/local/rlwrap
【root@dbserver rlwrap-0.30]#make
[root@dbserver rlwrap-0.30]#make install
2:使用方法
$ rlwrap [-options] <command> <args>
[oracle@dbserver ~]$ which rlwrap
/usr/local/rlwrap
[oracle@dbserver ~]$ /usr/local/rlwrap/bin/rlwrap/ sqlplus / as sysdba
如果嫌每次输入这么长的命令很麻烦的话,可以在 oracle用户下的 .bash_profil 中加入一条alias
alias sqlplus='/usr/local/rlwrap/bin/rlwrap sqlplus'.
发表评论