我使用的是ubuntu 10.04,,安装rlwrap的方式采用的是:sudo apt-get install rlwrap。
使用方式是:rlwrap sqlplus,进入后就可以使用方向键了。一种不需要输入rlwrap的方式是修改自己的bashrc,添加alias sqlplus='rlwrap sqlplus',使其生效后,以后就不再需要输入rlwrap就可以使用方向键了。
当在linux shell中运行sql*plus的时候,并不提供浏览历史命令行的功能。相反的,在windows操作系统上,当在dos命令窗口中运行sql*plus的时候,可以使用向上,向下键来跳回之前已经执行过的sql语句。你可以 根据需要修改他们,然后按[enter]重新提交执行。
为了在linux中达到同样的目的,你可以安装rlwrap,这个程式本身是个shell,可以运行任何你提供给它的命令包括参数,并添加命令历史浏览功能。 the rlwrap program is under the gpl license。
1:安装
rlwrap-0.28.tar.gz下载地址:~hlub/uck/rlwrap/
1):解压缩安装文件
[oracle@channel-mq3 ~]$gunzip rlwrap-0.28.tar.gz
[oracle@channel-mq3 ~]$tar xvf 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
2:使用
$ rlwrap [-options]
[oracle@channel-mq3 ~]$ which rlwrap
/usr/local/bin/rlwrap
[oracle@channel-mq3 ~]$ rlwrap sqlplus / as sysdba
sql*plus: release 10.2.0.1.0 - production on wed jul 18 10:31:11 2007
copyright (c) 1982, 2005, oracle. all rights reserved.
connected to:
oracle database 10g enterprise edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
sql> select * from v$sga;
name value
-------------------- ----------
fixed size 1219856
variable size 121635568
database buffers 310378496
redo buffers 7168000
-- 使用向上键调回最后执行的命令,按[enter]重新执行或修改后按[enter]执行
sql> select * from v$sga;
name value
-------------------- ----------
fixed size 1219856
variable size 121635568
database buffers 310378496
redo buffers 7168000
