rlwrap for Command Line History and Editing in SQL*Plus and RMAN on Linux

The rlwrap (readline wrapper) utility provides a command history and editing of keyboard input for any other command. This is a really handy addition to SQL*Plus and RMAN on Linux. This article explains how to install rlwrap and set it up for SQL*Plus and RMAN. Thanks for Lutz Hartmann for reminding me of this utility.

Download the latest rlwrap software from the following URL.

Unzip and install the software using the following commands.

gunzip rlwrap*.gz
tar -xvf rlwrap*.tar
cd rlwrap*
./configure
make
make check
make install

Run the following commands, or better still append then to the ".bash_profile" of the oracle software owner.

alias rlsqlplus='rlwrap sqlplus'
alias rlrman='rlwrap rman'

You can now start SQL*Plus or RMAN using "rlsqlplus" and "rlrman" respectively, and you will have a basic command history and the current line will be editable using the arrow and delete keys.

Thanks to Laurent Schneider for pointing out the potential dangers of using alias names of "sqlplus" and "rman", which include:

  • rlwrap may affect the behaviour of CTRL+C during interactive sessions. I've done a few tests on this and I can't see a difference in behavior of CTRL+C with or without rlwrap. Perhaps this was a problem with earlier versions.
  • rlwrap only supports interactive sessions, so scripts like the following may not work as expected.

    sqlplus <<EOF ... select ... EOF

    From what I can see the alias doesn't seem to work from within a shell script (bash, ksh or csh), so it doesn't really present a danger. Thanks Maxim for putting me on to this.

  • rlwrap is not an Oracle tool! I guess it's best to leave the sqlplus and rman commands clean and alias using a different name, just in case.

Hope this helps. Regards Tim...


转自 :http://www.oracle-base.com/articles/linux/rlwrap.php

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值