首页 > 代码库 > Oracle Sqlplus中上下键出现^[[A乱码问题

Oracle Sqlplus中上下键出现^[[A乱码问题

 

安装rlwrap

 

  1. 环境准备:

下载:http://utopia.knoware.nl/~hlub/uck/rlwrap/

或者 百度云盘:http://pan.baidu.com/s/1cnhO9S

 

需要先安装readline,否则会报一下错误:Youneed the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build thisprogram!

如下:

 

 

[root@17-150 ~]# cd /root

[root@17-150 ~]# ll

总用量 2295848

-rw-------. 1 root root       1616 7月  11 16:07 anaconda-ks.cfg

-rw-r--r--. 1 root root 1239269270 7月  14 09:35 linux.x64_11gR2_database_1of2.zip

-rw-r--r--. 1 root root 1111416131 7月  14 09:36 linux.x64_11gR2_database_2of2.zip

drwxrwxr-x 8  500  500      4096 7月  18 10:38 rlwrap-0.37

-rw-r--r-- 1 root root     251438 7月  18 10:37 rlwrap-0.37.tar.gz

[root@17-150 ~]# tar zxf rlwrap-0.37.tar.gz

[root@17-150 ~]# cd rlwrap-0.37

[root@17-150 rlwrap-0.37]# ll

total 408

-rw-rw-r-- 1 oracle dba  35029 Apr 30 2010 aclocal.m4

-rw-r--r-- 1 oracle dba    638 Aug 15 2006 AUTHORS

-rw-r--r-- 1 oracle dba   4267 May 5  2010 BUGS

-rw-r--r-- 1 oracle dba    105 Aug 10 2003 ChangeLog

drwxrwxr-x 2 oracle dba   4096 May 5  2010 completions

-rw-rw-r-- 1 oracle dba   7042 Apr 30 2010 config.h.in

-rwxr-xr-x 1 oracle dba 222847 Apr 30  2010 configure

-rw-r--r-- 1 oracle dba  11521 Apr 30 2010 configure.ac

-rw-r--r-- 1 oracle dba  17992 Aug 8  2006 COPYING

drwxrwxr-x 2 oracle dba   4096 May 5  2010 doc

drwxrwxr-x 2 oracle dba   4096 May 5  2010 filters

-rw-r--r-- 1 oracle dba   2019 Nov 23 2009 INSTALL

-rw-r--r-- 1 oracle dba   1272 Jan 23 2010 Makefile.am

-rw-rw-r-- 1 oracle dba  28316 Apr 30 2010 Makefile.in

-rw-r--r-- 1 oracle dba  16788 Apr 30 2010 NEWS

-rw-r--r-- 1 oracle dba   1394 Oct 24 2007 PLEA

-rw-r--r-- 1 oracle dba   3070 Jan 8  2010 README

drwxrwxr-x 2 oracle dba   4096 May 5  2010 src

drwxrwxr-x 2 oracle dba   4096 May 5  2010 test

-rw-r--r-- 1 oracle dba    310 Apr 16 2010 TODO

drwxrwxr-x 2 oracle dba   4096 May 5  2010 tools

[root@rtest rlwrap-0.37]#

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

checking build system type...i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking for a BSD-compatible install.../usr/bin/install -c

.......................................

checking for tgetent... no

checking for tgetent in -lcurses... no

checking for tgetent in -lncurses... no

checking for tgetent in -ltermcap... no

configure: WARNING: No termcap nor curseslibrary found

checking for readline in -lreadline... no

configure: error:

 

You need the GNU readlinelibrary(ftp://ftp.gnu.org/gnu/readline/ ) to build

this program!

提示错误:

configure: error:

You need the GNU readlinelibrary(ftp://ftp.gnu.org/gnu/readline/ ) to build

this program!

接下来,我们安装依赖包

 

1.安装readline

 [root@17-150 ~]#yum install readline-devel  readline

 

2.安装rlwrap

 

[root@17-150 ~]# tar zxf rlwrap-0.37.tar.gz

[root@17-150 ~]# cd rlwrap-0.37

[root@17-150 rlwrap-0.37]# ll

总用量 384

-rw-rw-r-- 1 500 500  35029 4月  30 2010aclocal.m4

-rw-r--r-- 1 500 500    638 8月  15 2006AUTHORS

-rw-r--r-- 1 500 500   4267 5月   5 2010BUGS

-rw-r--r-- 1 500 500    105 8月  10 2003ChangeLog

drwxrwxr-x 2 500 500     38 5月   5 2010completions

-rw-rw-r-- 1 500 500   7042 4月  30 2010config.h.in

-rwxr-xr-x 1 500 500 222847 4月  30 2010 configure

-rw-r--r-- 1 500 500  11521 4月  30 2010configure.ac

-rw-r--r-- 1 500 500  17992 8月   8 2006COPYING

drwxrwxr-x 2 500 500     65 5月   5 2010doc

drwxrwxr-x 2 500 500   4096 5月   5 2010filters

-rw-r--r-- 1 500 500   2019 11月 23 2009 INSTALL

-rw-r--r-- 1 500 500   1272 1月  23 2010Makefile.am

-rw-rw-r-- 1 500 500  28316 4月  30 2010Makefile.in

-rw-r--r-- 1 500 500  16788 4月  30 2010NEWS

-rw-r--r-- 1 500 500   1394 10月 24 2007 PLEA

-rw-r--r-- 1 500 500   3070 1月   8 2010README

drwxrwxr-x 2 500 500    308 5月   5 2010src

drwxrwxr-x 2 500 500     38 5月   5 2010test

-rw-r--r-- 1 500 500    310 4月  16 2010TODO

drwxrwxr-x 2 500 500     92 5月   5 2010 tools

 

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

checking build system type...x86_64-unknown-linux-gnu

checking host system type...x86_64-unknown-linux-gnu

checking for a BSD-compatible install.../usr/bin/install -c

checking whether build environment is sane...yes

checking for a thread-safe mkdir -p.../usr/bin/mkdir -p

.......................................

config.status: creating doc/Makefile

config.status: creating src/Makefile

config.status: creating doc/rlwrap.man

config.status: creating config.h

config.status: executing depfiles commands

 

Now do:

    make(or gmake)  to build rlwrap

    makecheck       for instructions how to testit

    makeinstall     to install it

 

[root@rtest rlwrap-0.37]#

 

 

[root@rtest rlwrap-0.37]# make

make  all-recursive

make[1]: Entering directory `/opt/rlwrap-0.37‘

Making all in doc

make[2]: Entering directory`/opt/rlwrap-0.37/filters‘

make[2]: Nothing to be done for `all‘.

make[2]: Leaving directory`/opt/rlwrap-0.37/filters‘

.....................................

make[2]: Entering directory `/opt/rlwrap-0.37‘

make[2]: Nothing to be done for `all-am‘.

make[2]: Leaving directory `/opt/rlwrap-0.37‘

make[1]: Leaving directory `/opt/rlwrap-0.37‘

 

[root@rtest rlwrap-0.37]# make install

Making install in doc

make[1]: Entering directory`/opt/rlwrap-0.37/doc‘

make[2]: Entering directory`/opt/rlwrap-0.37/doc‘

................................................

make[3]: Entering directory `/opt/rlwrap-0.37‘

chmod a+x /usr/local/share/rlwrap/filters/*

make[3]: Leaving directory `/opt/rlwrap-0.37‘

make[2]: Leaving directory `/opt/rlwrap-0.37‘

make[1]: Leaving directory `/opt/rlwrap-0.37‘

编译配置文件

[root@rtest rlwrap-0.37]# vi/home/oracle/.bash_profile

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

       . ~/.bashrc

fi

 

# User specific environment and startupprograms

 

export ORACLE_BASE=/u01/app/oracle

exportORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

export ORACLE_SID=TEST0422

exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export PATH=$ORACLE_HOME/bin:$PATH

 

PATH=$PATH:$HOME/bin

 

export PATH

 

stty erase ^H

aliassqlplus=‘rlwrap sqlplus‘

aliasrman=‘rlwrap rman‘

 

#添加如下内容

aliassqlplus=‘rlwrap sqlplus‘

aliasrman=‘rlwrap rman‘

 

"/home/oracle/.bash_profile" 25L,455C written

 保存退出,使文件立即生效。

[root@17-150 rlwrap-0.37]# source/home/oracle/.bash_profile

 


本文出自 “随心所欲” 博客,转载请与作者联系!

Oracle Sqlplus中上下键出现^[[A乱码问题