在 Linux中Oracle中如何使用rlwrap解决上下键使用出现乱码

2014-11-24 18:08:56 · 作者: · 浏览: 0

在Windows操作系统上,当在DOS命令窗口中运行SQL*Plus的时候,可以使用向上,向下键来跳回之前已经执行过的SQL语句.你可以根据需要修改他们,然后按Enter键重新提交执行. 然而,当在Linux Shell中运行SQL*Plus的时候,并不提供浏览历史命令行的功能. 为了在Linux中达到同样的目的,你可以安装rlwrap,这个程式本身是个Shell,可以运行任何你提供给它的命令包括参数,并添加命令历史浏览功能.The rlwrap program is under the GPL license.


一:安装readline



OS的安装光盘里提供了readline包.


error: Failed dependencies: libtermcap-devel is needed by readline-devel-5.1-1.1.i386.rpm


[root@oracle11g ~]# rpm -Uvh libtermcap-devel-2.0.8-46.1.i386.rpm


[root@oracle11g ~]# rpm -Uvh readline*


package readline-5.1-1.1 is already installed


[root@oracle11g ~]# rpm -Uvh readline-devel-5.1-1.1.i386.rpm


二:安装rlwrap


[root@oracle11g ~]# tar -zxvf rlwrap-0.30.tar.gz.zip


[root@oracle11g ~]# cd rlwrap-0.30


[root@oracle11g rlwrap-0.30]# ./configure


[root@oracle11g rlwrap-0.30]# make


[root@oracle11g rlwrap-0.30]# make install


三:方便使用rlwrap


[root@oracle11g rlwrap-0.30]# vi /u01/oracle/.bash_profile


添加


alias sqlplus='rlwrap sqlplus'


alias rman='rlwrap rman'


Linux下的SQL Plus 终于可以像Windows下的那样使用了。