您的位置:首页 > 数据库

解决sqlplus中输错命令时的删除、光标键不能使用问题

2014-04-08 02:04 393 查看
解决sqlplus中输错命令时的删除、光标键不能使用问题sqlplus中打错sql命令时不能回撤,不能修改,只能回车重新写,非常麻烦。看到 一位朋友写了,我也记录一下。出错如下:BYS@bys1>aa ^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@oel-01 ~]# ls rlwrap-0.37.tar.gz[root@oel-01 ~]# tar -zxvfrlwrap-0.37.tar.gz[root@oel-01 rlwrap-0.37]# pwd/root/rlwrap-0.37[root@oel-01 rlwrap-0.37]# ./configure[root@oel-01 rlwrap-0.37]# make[root@oel-01 rlwrap-0.37]# make install2.配置打开SQLPLUS/RMAN等时使用rlwrap在操作ORACEL的用户的.bash_profile文件中增加如下两句:[root@oel-01 oracle]# pwd/home/oracle[root@oel-01 oracle]# cat .bash_profile……………………alias sqlplus='rlwrap sqlplus'alias rman='rlwrap rman'配置环境变量参数后使用ORACLE用户验证下[oracle@oel-01 ~]$ source .bash_profile 如下报错是因为我尚未安装ORACEL,所以没有SQLPLUST 和RMAN。但是可以看到 输入sqlplus使用的是rlwrap sqlplus[oracle@oel-01 ~]$ sqlplusrlwrap: Cannot execute sqlplus: No suchfile or directory[oracle@oel-01 ~]$ rmanrlwrap: Cannot execute rman: No such fileor directory当然不SOURCE环境变量而重登陆SSH客户端也是可以的。方法二:属于临时解决方法--本人已验证,还是建议用上一种安装rlwrap软件的方法临时的方法:在console里输入stty erase ^H, 然后再使用sqlplus 来连接数据库。此时可以使用删除,但是不能使用上下左右的光标键,会乱码^[[A^[[B^[[B。[oracle@bys001 ~]$ stty erase ^H[oracle@bys001 ~]$ sqlplus bys/bysSQL*Plus: Release 11.2.0.1.0 Production on Mon Nov 4 22:42:37 2013Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsBYS@bys1>aaa bb^[[D^[[D^[[D^[[D^[[C^[[C^[[A^[[A^[[B^[[B永久的方式:在用户的.bash_profile里面加入:--同上一步修改环境变量的方法。stty erase ^HPUTTY中可以在PUTTY的设置中:设置――TERMINAL--KEYBOARD --THE Backspace key 选中CONTROL-H
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: