rlwrap工具可以解决linux下sqlplus提供浏览历史命令行的功能,和删除先前输入错误的字母等问题
一、构建rlwap安装环境
rlwrap依赖于readline,而readline依赖于libtermcap,所以需要先安装如下几个包:
libtermcap-devel
readline
readline-devel
注意:如果是64位linux系统,需要安装32bit和64bit的上述3个软件包。
二、安装rlwrap
1、解压rlwrap
[root@rhel /]# tar zxvf rlwrap-0.37.tar.gz
2、编译并安装rlwap
[root@rhel /]# cd /rlwrap-0.37
[root@rhel rlwrap-0.37]# ./configure
[root@rhel rlwrap-0.37]# make&make install
三、使用rlwrap工具调用sqlplus或rman
1、以sqlplus为例说明使用方法
[root@rhel rlwrap-0.37]# su - oracle
[oracle@rhel ~]$ alias sqlplus='rlwrap sqlplus'
[oracle@rhel ~]$ sqlplus sys/Huawei123 as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Aug 24 11:33:18 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
SQL>
2、为了使该功能长期生效,须在oracle家目录设置如下:
[oracle@rhel ~]$ vim /home/oracle/.bash_profile
在文件末尾加入:
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
3、测试
[oracle@rhel ~]$ sqlplus sys/Huawei123 as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Aug 24 11:45:07 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL>