Home  >  Article  >  Database  >  rlwrap 实现键盘上下箭头,调出历史执行的SQL命令

rlwrap 实现键盘上下箭头,调出历史执行的SQL命令

WBOY
WBOYOriginal
2016-06-07 17:13:271196browse

在Linux平台下,想在Oracle数据库的SQL*PLUS的命令行提示符下,利用键盘上的上下箭头,调出历史执行的SQL命令,可以考虑采用rlwr

在Linux平台下,想在Oracle数据库的SQL*PLUS的命令行提示符下,利用键盘上的上下箭头,调出历史执行的SQL命令,可以考虑采用rlwrap这一开源工具。
 
现,,简单记录一下安装过程(Red Hat Enterprise Linux as 5.4环境)。

① 首先下载rlwrap:
地址如下找到复合自己操作系统版本的下载:

② 安装相关的包

libtermcap-devel-2.0.8-46.1.i386.rpm
readline-devel-5.1-1.1.i386.rpm

[root@server1 ~]# rpm -ivh libtermcap-devel-2.0.8-46.1.i386.rpm
warning: libtermcap-devel-2.0.8-46.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
1:libtermcap-devel       ########################################### [100%]

[root@server1 ~]# rpm -ivh readline-devel-5.1-1.1.i386.rpm
warning: readline-devel-5.1-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
1:readline-devel         ########################################### [100%]

③ 安装rlwrap包
[root@ ~]# rpm -ivh rlwrap-0.37-1.el5.i386.rpm
warning: rlwrap-0.37-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
   1:rlwrap                 ########################################### [100%]
[root@ ~]#

④ 修改oracle 用户的配置文件
[root@ ~]# su - oracle
[oracle@ ~]$ vi .bash_profile

alias sqlplus='rlwrap sqlplus /nolog'    --(在最好添加这信息,并!wq保存退出)
[oracle@ ~]$ source .bash_profile

⑤ 这样就已经完成了,只需用root用户执行sqlplus就可以进入SQL*PLUS的命令行提示符,并且可以利用键盘的上下键调出之前执行过的历史命令。

更多Oracle相关信息见Oracle 专题页面 ?tid=12

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn