linux下sqlplus调出历史命令--rlwrap介绍

转自:http://space.itpub.net/15142212/viewspace-558108

1:安装

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

(现是已升级到0.30了)

1):解压缩安装文件

[oracle@Channel-MQ3~]$gunziprlwrap-0.28.tar.gz

[oracle@Channel-MQ3~]$tarxvfrlwrap-0.28.tar

2):切换到root用户,执行下面的命令

[root@Channel-MQ3~]#cd/home/oracle/rlwrap-0.28

[[email protected]]#ls

aclocal.m4completionsconfigureINSTALLREADMETODO

AUTHORSconfig.hconfigure.acMakefilesrctools

bash30-005.patchconfig.h.inCOPYINGMakefile.amstamp-h1

BUGSconfig.logdistributionMakefile.intest

ChangeLogconfig.statusdocNEWStest.log

[[email protected]]#./configure

[[email protected]]#make

[[email protected]]#makeinstall

2:使用

$rlwrap[-options]<command><args>

[oracle@Channel-MQ3~]$whichrlwrap

/usr/local/bin/rlwrap

[oracle@Channel-MQ3~]$rlwrapsqlplus/assysdba

SQL*Plus:Release10.2.0.1.0-ProductiononWedJul1810:31:112007

Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,OLAPandDataMiningoptions

SQL>select*fromv$sga;

NAMEVALUE

------------------------------

FixedSize1219856

VariableSize121635568

DatabaseBuffers310378496

RedoBuffers7168000

--使用向上键调回最后执行的命令,按[Enter]重新执行或修改后按[Enter]执行

SQL>select*fromv$sga;

NAMEVALUE

------------------------------

FixedSize1219856

VariableSize121635568

DatabaseBuffers310378496

RedoBuffers7168000

另外rlwrap还有很多选项可以设置

eg:

−l,−−logfilefile

Appendcommand’soutput(includingecho’eduserinput)tofile(creatingfilewhenitdoesn’texist).

测试如下

[oracle@Channel-MQ3~]$rlwrap-lbenbotest.logsqlplus/assysdba

SQL*Plus:Release10.2.0.1.0-ProductiononWedJul1810:34:502007

Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,OLAPandDataMiningoptions

SQL>select*fromv$version;

BANNER

----------------------------------------------------------------

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Prod

PL/SQLRelease10.2.0.1.0-Production

CORE10.2.0.1.0Production

TNSforLinux:Version10.2.0.1.0-Production

NLSRTLVersion10.2.0.1.0-Production

SQL>exit

DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,OLAPandDataMiningoptions

[oracle@Channel-MQ3~]$catbenbotest.log

[rlwrap]WedJul1810:34:502007

SQL*Plus:Release10.2.0.1.0-ProductiononWedJul1810:34:502007

Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,OLAPandDataMiningoptions

SQL>select*fromv$version;

BANNER

----------------------------------------------------------------

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Prod

PL/SQLRelease10.2.0.1.0-Production

CORE10.2.0.1.0Production

TNSforLinux:Version10.2.0.1.0-Production

NLSRTLVersion10.2.0.1.0-Production

SQL>exit

DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,OLAPandDataMiningoptions

[oracle@Channel-MQ3~]$

其它选择轻参考manpage.

相关资源:

rlwrap-0.28.tar.gz(150k)http://utopia.knoware.nl/~hlub/uck/rlwrap/

Themanpagehttp://utopia.knoware.nl/~hlub/uck/rlwrap/man.html

TheREADMEfilehttp://utopia.knoware.nl/~hlub/uck/rlwrap/README.txt

CHANGEShttp://utopia.knoware.nl/~hlub/uck/rlwrap/CHANGES.txt

相关推荐