在linux中使用sqlplus的上下左右箭头的方法

在linux下面使用sqlpus连接数据库处理,实在不是很方便,还好有一个工具rlwrap,通过这个能够调用历史命令和回调功能,能够极大的提高效率。

1、 下载

http://utopia.knoware.nl/~hlub/uck/rlwrap/下载rlwrap-0.37.tar.gz

2、 解压缩安装

[root@localhosttmp]# tar -zxvf rlwrap-0.37.tar.gz

[root@localhosttmp]# cd rlwrap-0.37

[root@localhostrlwrap-0.37]# ls

[root@localhostrlwrap-0.37]# ./configure

[root@localhostrlwrap-0.37]#make

[root@localhostrlwrap-0.37]#make install

3、 验证安装结果

[root@localhost rlwrap-0.37]#su – oracle

[oracle@localhost ~]$ rlwrap sqlplus

SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 10 21:51:09 2012

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Enter user-name: / as sysdba

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> select sysdate from dual;

SYSDATE
---------
10-JAN-12

SQL> select sysdate from dual;

SYSDATE
---------
10-JAN-12

4、安装报错

rlwrap:error while loadingshared libraries:libreadline.so.5:cannot open shared object file:No suchfile or directory

解决办法:

在oracle下的.bash_profile中$PATH路径中增加/usr/local/bin路径

PATH=/usr/local/bin:$PATH;export PATH

5、 编辑oracle用户下的.bash_profile

增加

alias sqlplus=’rlwrap sqlplus’

alias rman=’rlwrap rman’

原文地址:https://www.cnblogs.com/moveofgod/p/3480368.html