rlwrap的安装和配置
在Linux中安装完Oracle后,使用sqlplus上下键比较费劲,安装了rlwrap之后就能通过上下键翻回历史命令了,提高效率。
rlwrap源码托管在GitHub上,可以通过下载地址 https://github.com/hanslub42/rlwrap 下载到该软件。
1、 安装readline 在Centos6.7操作系统的安装光盘Packages目录里提供有readline包。 [root@dbserver rlwrap-0.30]# cd /media/CentOS_6.7_Final/Packages/
[root@dbserver Packages]# ll readline* -r–r–r– 3 root root 182628 Jun 25 2012 readline-6.0-4.el6.x86_64.rpm -r–r–r– 2 root root 137392 Jun 25 2012 readline-devel-6.0-4.el6.x86_64.rpm
[root@dbserver Packages]# rpm -ivh readline-6.0-4.el6.x86_64.rpm Preparing… ########################################### [100%] package readline-6.0-4.el6.x86_64 is already installed
[root@dbserver Packages]# rpm -ivh readline-devel-6.0-4.el6.x86_64.rpm error: Failed dependencies:
[root@dbserver Packages]# rpm -ivh ncurses-devel-5.7-4.20090207.el6.x86_64.rpm Preparing… ########################################### [100%] 1:ncurses-devel ########################################### [100%]
[root@dbserver Packages]# rpm -ivh readline-devel-6.0-4.el6.x86_64.rpm Preparing… ########################################### [100%] 1:readline-devel ########################################### [100%]
2、 安装rlwrap 通过源码编译安装。 [root@dbserver Packages]# cd /opt/software [root@dbserver software]# tar zxvf rlwrap-0.30.tar.gz [root@dbserver software]# cd rlwrap-0.30 [root@dbserver rlwrap-0.30]# ./configure [root@dbserver rlwrap-0.30]# make [root@dbserver rlwrap-0.30]# make install
3、 设置Oracle用户环境变量 切换到Oracle用户再添加两行alias配置并使该文件生效即可。 su – oracle echo alias sqlplus=’\rlwrap sqlplus\’ >> .bash_profile echo alias sqlplus=’\rlwrap rman\’ >> .bash_profile source ./bash_profile
注意:观察安装及编译过程中的输出信息