Linux中安装完Oracle后,默认的 sqlplus
上下键是不能用的,安装了 rlwrap
之后就能通过上下键翻回历史命令了
- 安装readline 及 依赖
[root@ogg1 rlwrap-0.43]# yum install readline*
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile
包 readline-6.0-4.el6.x86_64 已安装并且是最新版本
解决依赖关系
--> 执行事务检查
---> Package readline-devel.x86_64 0:6.0-4.el6 will be 安装
---> Package readline-static.x86_64 0:6.0-4.el6 will be 安装
--> 完成依赖关系计算
依赖关系解决
===============================================================================================================================================================
软件包 架构 版本 仓库 大小
===============================================================================================================================================================
正在安装:
readline-devel x86_64 6.0-4.el6 base 134 k
readline-static x86_64 6.0-4.el6 base 113 k
事务概要
===============================================================================================================================================================
Install 2 Package(s)
总下载量:248 k
Installed size: 790 k
确定吗?[y/N]:y
下载软件包:
(1/2): readline-devel-6.0-4.el6.x86_64.rpm | 134 kB 00:00
(2/2): readline-static-6.0-4.el6.x86_64.rpm | 113 kB 00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 231 kB/s | 248 kB 00:01
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装 : readline-devel-6.0-4.el6.x86_64 1/2
正在安装 : readline-static-6.0-4.el6.x86_64 2/2
Verifying : readline-static-6.0-4.el6.x86_64 1/2
Verifying : readline-devel-6.0-4.el6.x86_64 2/2
已安装:
readline-devel.x86_64 0:6.0-4.el6 readline-static.x86_64 0:6.0-4.el6
完毕!
- 上传、解压、编译、安装rlwrap
[root@ogg1 ~]# tar -zxvf rlwrap-0.43.tar.gz
[root@ogg1 ~]# cd rlwrap-0.43
[root@ogg1 rlwrap-0.43]# ./configure && make && make install
- 配置shell
[root@ogg1 rlwrap-0.43]# su - oracle
[oracle@ogg1 ~]$ vim .bash_profile
最后增加以下配置,使oracle相关命令都支持回退和上下键
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias lsnrctl='rlwrap lsnrctl'
- 其它问题
- checking build system type...
Invalid configurationx86_64-unknown-linux-': machine
x86_64-unknown-linux'not recognized
configure: error: /bin/sh tools/config.sub x86_64-unknown-linux- failed解决:需要安装GCC,执行命令:yum install -y gcc
- You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/) to build this program!
解决:需要安装libtermcap-devel,执行命令:yum install -y libtermcap-devel 实际上RLwrap的安装需要两个依赖包:readline和libtermcap-devel readline一般都会集成在Linux里,所以这里直接安装libtermcap-devel
- bash: make: command not found
解决:需要安装make,执行命令:yum install -y make*