在Linux下使用sqlplus就不像windows那么上下键翻命令了。可以通过插件来解决rlwrap。
1.首先安装readline
[root@rac2 opt]# wget ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz [root@rac2 opt]# tar -xzvf readline-6.2.tar.gz [root@rac2 opt]# cd readline-6.2 [root@rac2 opt]# ./configure [root@rac2 opt]# make [root@rac2 opt]# make install
2.安装rlwrap
[root@rac2 opt]#wget http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.42.tar.gz [root@rac2 opt]# tar -xzvf rlwrap-0.42 [root@rac2 opt]# cd rlwrap-0.42 [root@rac2 opt]# ./configure configure: error:
You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build
this program!
解决办法:
安装这个包
[root@rac2 opt]# yum install libtermcap-devel
下面继续安装rlwrap
[root@rac2 rlwrap-0.42]# make [root@rac2 rlwrap-0.42]# make install
搞定了。
3.bash_profile中进行设置。
#vi .bash_profile alias sqlplus="rlwrap sqlplus" alias rman="rlwrap rman"
可能还会出现下面的错误
[oracle@rac2 ~]$ rlwrap sqlplus / as sysdba rlwrap: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory
若没有安装readline则安装。要是安装了则修改一下
[root@rac2 readline-6.2]# cp /etc/ld.so.conf /etc/ld.so.conf.bak [root@rac2 readline-6.2]# vi /etc/ld.so.conf
添加一行
/usr/local/lib
然后使其生效
[root@rac2 readline-6.2]# ldconfig
如果出现:
bash: ldconfig: command not found
则:root环境变量中加export PATH=/sbin
[oracle@rac2 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Sat Sep 19 14:55:03 2015 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> dfsdf SP2-0042: unknown command "dfsdf" - rest of line ignored. SQL> dfsdf
版权声明:本文为博主原创文章,未经博主允许不得转载。