Home > linux, oracle > Rlwrap in SQL*Plus to keep a command history

Rlwrap in SQL*Plus to keep a command history


If you regularly use sqlplus then you will probably miss a command history. Well, you can solve this problem by using the rlwrap command, which keeps a history for every command you used.

To use rlwrap, just install it from apt, yum or download id from the following url:

http://utopia.knoware.nl/%7Ehlub/uck/rlwrap/

The current version is 0.36.

To use it, after you have installed the tool, just add an alias in your .bash_profile the following way:

alias rlsqlplus=’rlwrap sqlplus’

This way, every time you call sqlplus in the future, you will keep a really useful history of your commands for future reference. I find this tool very useful, for example for correcting mistyped commands.

I don’t recommend using alias sqlplus=’rlwrap sqlplus’, because rlwrap doesn’t allow to execute commands in a interactive way. So your scheduled scripts by the method sqlplus<<EOF may fail. Be careful!

But if you use alias rlsqlplus=’rlwrap sqlplus’, then your problem will be solved.

You can also use rlwrap with other commands, like RMAN:

alias rlrman=’rlwrap rman’

Enjoy!

Advertisements
Categories: linux, oracle

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: