oracle linux 6.8 安装和配置rlwrap,方便oracle的SQL输入历史命令回显

环境:
Oracle Enterprise Linux 6.8
先安装依赖包
#yum -y install readline readline-devel
我们先来看看软件包是否已经安装了
[root@redhat86 Packages]# rpm -qa | grep readline
compat-readline5-5.2-17.1.el6.x86_64
readline-6.0-4.el6.x86_64
从上面的查看命令来看,找不到readline-devel的依赖包,那么我们首先要安装readline-devel
#yum -y install readline-devel
上面在线安装readline-devel提示在安装这个包之前,要先安装ncurses-devel,才能继续顺利安装readline-devel,如下提示:
[root@redhat86 tmp]# rpm -Uvh readline-devel-6.0-4.el6.x86_64.rpm
error: Failed dependencies:
ncurses-devel is needed by readline-devel-6.0-4.el6.x86_64
ncurses-devel的下载地址和安装方法如下:
假设现在的目录是/tmp
#wget http://rpmfind.net/linux/centos/6.10/os/x86_64/Packages/ncurses-devel-5.7-4.20090207.el6.x86_64.rpm
[root@redhat86 tmp]# rpm -Uvh ncurses-devel-5.7-4.20090207.el6.x86_64.rpm
warning: ncurses-devel-5.7-4.20090207.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing… ########################################### [100%]
1:ncurses-devel ###########################################
找到光盘上的readline-devel安装包,并安装
#cd media
[root@media]#rpm -Uvh readline-devel-6.0-4.el6.x86_64.rpm
[root@redhat86 Packages]# rpm -Uvh readline-devel-6.0-4.el6.x86_64.rpm
Preparing… ########################################### [100%]
1:readline-devel ########################################### [100%]
[root@redhat86 Packages]# rpm -qa | grep readline
compat-readline5-5.2-17.1.el6.x86_64
readline-devel-6.0-4.el6.x86_64
readline-6.0-4.el6.x86_64
下载rlwrap-0.42-1.el6.x86_64.rpm,并安装
#wget http://rpmfind.net/linux/epel/6/x86_64/Packages/r/rlwrap-0.42-1.el6.x86_64.rpm
[root@redhat86 tmp]# rpm -Uvh rlwrap-0.42-1.el6.x86_64.rpm
warning: rlwrap-0.42-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing… ########################################### [100%]
1:rlwrap ########################################### [100%]
[root@redhat86 tmp]#
#su -oracle
在profile文件 .bash_profile中添加以下两行
alias sqlplus=‘rlwrap sqlplus’
alias rman=‘rlwrap rman’
保存
并使用下列命令
#rlwrap sqlplus /nolog
oracle linux 6.8 安装和配置rlwrap,方便oracle的SQL输入历史命令回显
现在在sql>命令提示符下输入一遍数据库操作相关命令,按光标上下键就可以回显出
原来输入的命令行了。

上一篇:java – 我应该如何从缓冲读卡器中读取?


下一篇:最强大的使用Java读取文件或流的方法(防止DoS攻击)