在CentOS下为sqlplus和rman 添加rlwrap

Posted on 2014-10-04 14:57  ArcticF0X  阅读(780)  评论(0编辑  收藏  举报

在Linux中sqlplus和rman无法像我们在shell中,能使用方向键和退格键对语句惊醒一些更改。

这实在是很苦恼的事情。
不过有rlwrap来对sqlplus和rman进行一些扩展,让我的操作不那么苦逼了。
下面是在Centos6中安装rlwarp的方法。
 
1.安装readline-devel
    shell>su - root
    shell>yum install readline-devel
 
2.下载rlwrap
    在http://utopia.knoware.nl/~hlub/uck/rlwrap/ 找到最新的rlwrap源码包
 
3.解压编译安装
    shell> tar zxvf rlwrap-0.41.tar.gz
    shell>./configure
    shell>make & make install
 
4.如果上面的步骤都没有报错了吧,我们就可以为sqlplus添加rlwrap支持了,下面以oracle用户为例
     shell>su - oracle
     shell>vim ~/.bash_profile
      为sqlplus和rman添加rlwrap支持,在bash_profile添加如下内容
        alias sqlp='rlwrap sqlplus' 
        alias rman='rlwrap rman'
 
5.重新用oracle这个用户登陆,或者我们应用下.bash_profile,再次使用sqlp和rman就发现可以使用方向键和退格键了。
     应用.bash_profile的两种方法
    shell>./.bash_profile
     shell>source .bash_profile