sqlplus中打错sql命令时不能回撤,不能修改,只能回车重新写


出错如下:  ^H^H^[[D^[[D^[[C^[[C^[[A^[[A


使用rlwrap+SQLPLUS方法


1.安装rlwrap软件


安装rlwrap之前需要readline。


readline可以直接在安装光盘中找到 ,也可以自己上传RMP包到光盘进行安装。


yum -y install readline-devel-5.1-3.el5.i386.rpm


然后安装rlwrap,需要自己上传安装包到 服务器,进行安装。


[root@catch ~]# ls


 rlwrap-0.37.tar.gz


[root@catch ~]# tar -zxvf rlwrap-0.37.tar.gz


[root@catch rlwrap-0.37]# pwd


/root/rlwrap-0.37


[root@catch rlwrap-0.37]# ./configure


[root@catch rlwrap-0.37]# make


[root@catch rlwrap-0.37]# make install


2.配置打开SQLPLUS/RMAN等时使用rlwrap


在操作ORACEL的用户的.bash_profile文件中增加如下两句:


[root@catch oracle]# pwd


/home/oracle


[root@catch oracle]#export alias sqlpls='rlwrap sqlplus'


[root@catch oracle]#export alias rman='rlwrap rman'


[root@catch oracle]# cat .bash_profile


……………………


alias sqlplus='rlwrap sqlplus'


alias rman='rlwrap rman'


配置环境变量参数后使用ORACLE用户验证下


[oracle@catch ~]$ source .bash_profile


[oracle@catch ~]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jul 7 23:13:50 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Enter user-name: scott
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@catch ~]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jul 7 23:22:57 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

RMAN>


好了,命令使用正常,在sqlplus中输入错命令能用删除键删除错误了!

以上已经过测试,方法可行!