Oracle Database for Linux 不能使用退格键


方法一:要使用退格键的时候,同时按住ctrl+backspace

方法二:在任意一个启动脚本中添加如下内容
[Oracle@night ~]$ tail -1 .bash_profile
stty    erase  ^H

stty的意思是set tty,主要是用来检查和修改当前注册的终端的通信参数
如上两种方法只是单一的解决了退格键的问题,如果我想回调sqlplus中执行过的命令 还是不行

方法三:可以使用退格键,可以回调sqlplus中执行过的命令
使用第三方工具rlwrap  下载见 

压安装完毕之后
[oracle@night u01]$ ls
app  install  rlwrap
[oracle@night u01]$  cd rlwrap/
[oracle@night rlwrap]$ ls
bin  share
[oracle@night rlwrap]$
[oracle@night rlwrap]$ cd bin/
[oracle@night bin]$ ll
总计 168
-rwxr-xr-x 1 oracle oinstall 165717 07-25 23:33 rlwrap
[oracle@night bin]$

添加到PATH中

[oracle@night ~]$ vim .bash_profile

export PATH=$PATH:$ORACLE_BASE:$ORACLE_HOME/bin:/u01/rlwrap/bin

立即生效
[oracle@night ~]$ source .bash_profile
[oracle@night ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/u01/app/oracle:/u01/app/oracle/product/bin:/home/oracle/bin:/u01/app/oracle:/u01/app/oracle/product/bin:/u01/rlwrap/bin
[oracle@night ~]$

[oracle@night ~]$ rl
rlatopam  rletopnm  rlog      rlogin    rlwrap   
[oracle@night ~]$ rl

使用
[oracle@night ~]$ rlwrap sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 25 23:37:55 2013
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
SQL> conn sys/ as sysdba
Enter password:
Connected.
SQL>

也可以使用命令别名
[oracle@night ~]$ alias sqlplus='rlwrap sqlplus'
[oracle@night ~]$ alias
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias sqlplus='rlwrap sqlplus'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[oracle@night ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 25 23:39:36 2013
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

如果想下次生效,可添加到启动脚本内

相关内容