window下的sqlplus可以通过箭头键,来回看历史命令,用起来非常的方便。
但是在Linux下,会出现各种乱码,非常不方便,如下图所示,每次打错一个字符就需要重新打一遍。
解决办法:rlwrap 可以用来支持Oracle下sqlplus历史命令的回调功能,提高效率。
解决过程:
1、首先下载rlwrap和readline;
1
2
|
readline-6.3.tar.gz rlwrap-0.30.tar.gz |
2、安装readline包
1
2
3
4
5
|
tar -zxvf readline-6.3.tar.gz cd readline-6.3 ./configure make make install |
3、安装rlwrap
1
2
3
|
tar -zxvf rlwrap-0.30.tar.gz cd rlwrap-0.30 ./configure |
出现问题:You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build this program!
解决办法:yum install readline*,执行后出现如下问题
Error Downloading Packages:
readline-static-6.0-4.el6.x86_64: failure:
Packages/readline-static-6.0-4.el6.x86_64.rpm from base: [Errno 256] No
more mirrors to try.
ncurses-libs-5.7-4.20090207.el6.x86_64: failure:
Packages/ncurses-libs-5.7-4.20090207.el6.x86_64.rpm from base: [Errno
256] No more mirrors to try.
readline-devel-6.0-4.el6.x86_64: failure:
Packages/readline-devel-6.0-4.el6.x86_64.rpm from base: [Errno 256] No
more mirrors to try.
ncurses-devel-5.7-4.20090207.el6.x86_64: failure:
Packages/ncurses-devel-5.7-4.20090207.el6.x86_64.rpm from base: [Errno
256] No more mirrors to try.
ncurses-base-5.7-4.20090207.el6.x86_64: failure:
Packages/ncurses-base-5.7-4.20090207.el6.x86_64.rpm from base: [Errno
256] No more mirrors to try.
如果这些包安装失败,可以到官网上找这些包下载独立安装,安装无误后,在一次尝试:
可以从这个网址进行下载 ,包很全: http://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/ (需要FQ)
安装下载的依赖包:
rpm -ivh --force readline-static-6.0-4.el6.x86_64.rpm ncurses-libs-5.7-4.20090207.el6.x86_64.rpm readline-devel-6.0-4.el6.x86_64.rpm ncurses-devel-5.7-4.20090207.el6.x86_64.rpm ncurses-base-5.7-4.20090207.el6.x86_64.rpm
然后再尝试安装rlwrap:
1
2
3
|
./configure make make install |
使用方法:
1、首先配置一些信息,在oracle用户下的.bash_profile中添加以下信息:
1
2
3
|
alias sqlplus= '/usr/local/rlwrap/bin/rlwrap sqlplus' (添加命令) alias sqlplus= 'rlwrap sqlplus' (去除每次都需要输入rlwrap的麻烦) alias rman= 'rlwrap rman' |
2、source .bash_profile 后就可以使用了
以上所述是小编给大家介绍的Linux下Oracle中SqlPlus时上下左右键乱码问题的解决办法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!