linux sqlplus 命令 历史 快捷键,在linux系统下的SQL*Plus实现历史命令调用

在linux系统下的SQL*Plus实现历史命令调用

在windows上使用sqlplus,可以用上下键调用历史执行过的命令,而且可以移动光标方便的修改命令,在linux也可以实现也可以实现这样的功能,步骤如下:

1.在下载rlwrap-0.37.tar.gz

2.在root用户下,解压缩并安装rlwrap

[root@test001 ~]# cd /tmp

[root@test001 tmp]# ls

EM_TARGET_INSTALLER.lk fSBiYqd4LP keyring-b3dRDv orbit-root readline-6.2.tar.gz swapinfo.txt LinuxVendor_output.txt gconfd-root lquIz3kejR pkginfo.txt rlwrap-0.37.tar.gz tmpFileKernelParms.txt cpuinfo.txt glibc.txt mapping-root readline-6.2 ssh-sweemq5932 xses-root.CfIUwB

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

[root@test001 tmp]# cd rlwrap-0.37

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

自动安装结束后,输出末尾显示为安装成果,出错信息如下:

checking for readline in –lreadline… no

configure: error:

You need the GNU readline library( ) to build

this program!

错误信息提示需要readline包编译该程序,我使用的是Linux版本:

[root@test001 ~]# uname -a

Linux test001 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:39:47 EDT 2008 i686 i686 i386 GNU/Linux

没有安装readline,得去下载readline,我下载的是readline-6.2.tar.gz,下载完后,在root用户下解压缩并安装

[root@test001 tmp]# tar -zxvf readline-6.2.tar.gz

解压完后,安装readline

[root@test001 tmp]# cd readline-6.2

[root@test001 readline-6.2]# ./configure && make && make install

安装完成后,在重新安装rlwrap

[root@test001 rlwrap-0.37]# ./configure && make && make install

3.安装完毕,开始测试

切换到oracle用户下

[root@test001 ~]# su - oracle

[oracle@test001 ~]$ rlwrap sqlplus / as sysdba

rlwrap: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory

不能用,发出报错信息。切换到root用户下,修改/etc/ld.so.conf文件将/usr/local/lib添加到该文件中:

[oracle@test001 ~]$ su -

Password:

[root@test001 ~]# vi /etc/ld.so.conf

[root@test001 ~]# cat /etc/ld.so.conf

include ld.so.conf.d/*.conf

/usr/local/lib

添加进去后需要重启主机或者执行ldconfig命令使其即使生效:

[root@test001 ~]# ldconfig

4.再次测试

[oracle@test001 ~]$ rlwrap sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Aug 18 04:18:57 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select * from dual;

D

-

X

SQL>

然后就可以使用上下键来调用已经执行多的命令了。

5.走点捷径

如果觉得每次敲rlwrap很麻烦,可以编辑oracle用户的环境变量.bash_profile添加以下信息

alias sqlplus=”rlwrap sqlplus”

alias rman=”rlwrap rman”

alias lsnrctl=”rlwrap lsnrctl”

[oracle@test001 ~]$ vi .bash_profile

[oracle@test001 ~]$ sqlplus / as sysdba

搞定。[@more@]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值