[转]sqlplus中不能上下键选择前一条命令解决方法

安装一个叫rlwrap的工具:
已经上传到本文附件:后缀为.rar,主要是51cto不支持.tar.gz后缀,实际上是一个tar.gz压缩包
 
tar -zxvf rlwrap-0.30.tar.gz
cd rlwrap-0.30
./configure
make
make install

注:ubuntu 可以 apt-get install rlwrap 安装 

把下两句写入运行oracle的用户.bash_profle(~/.bashrc都得)文件中:
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
 
这样就能使用上下键切换到历史命令去了。同时还能使用回退键修改错误的命令。
否则需要使用ctrl+回退键才行。
 
 
要使用回退键,还有另外一个方法:
在oracle用户的.bash_profile 中添加
stty erase ^h
再执行
# . ~oracle/.bash_profile
但是这样不能使用上下键。

本文出自 “jasonyong” 博客,请务必保留此出处http://jasonyong.blog.51cto.com/47753/247821










linux中的ORACLE

 sqlplus默认不支持向系统或WINDOWS那要向上、向下查询命令记录

 

不果可以安装一个程序来支持

 

它就是 rlwrap

从网上找个安装包,解压

 

一:安装rlwrap

[root@oracle11g ~]# tar -zxvf rlwrap-0.30.tar.gz [root@oracle11g ~]# cd rlwrap-0.30 [root@oracle11g rlwrap-0.30]# ./configure [root@oracle11g rlwrap-0.30]# make [root@oracle11g rlwrap-0.30]# make install 

如果在make 时提示


checking for tgetent in -lncurses... no
checking for tgetent in -ltermcap... no
configure: WARNING: No termcap nor curses library found
checking for readline in -lreadline... no
configure: error:

You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ to build
this program!

 

那你就要安装readline-devel-5.1-1.1.i386包

 

但安装它还要有个前提是已安装

libtermcap-devel-2.0.8-46.1.i386包

 

系统中如果安装就查看是否安装devel版如

readline-5.1-1.1
readline-devel-5.1-1.1

 

二配置环境变量

[root@oracle11g rlwrap-0.30]# vi /home/oracle/.bash_profile 添加 alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' 
Linux下的SQL Plus 终于可以像Windows下的那样使用了。 

posted @ 2013-04-02 00:52  Gateman  阅读(456)  评论(0编辑  收藏  举报