Using readline with Oracle SQL*Plus

By default, Oracle's SQL*Plus has no support for history, command line editing, etc.

This problem can be solved with the rlwrap utility. There is a Debian package, or you can easily compile it for any system.

Source is here: http://utopia.knoware.nl/~hlub/rlwrap/.

Once installed, add this alias to your .bashrc:

alias sqlplus="rlwrap -i -f ~/.sqlplus_history -H ~/.sqlplus_history -s 30000 sqlplus"

This defines a history file and uses it as your completion wordlist, and sets the history size to 30000 entries.

Before running it for the first time, do a:

touch ~/.sqlplus_history

That's all there is to it, and now you have readline support in your SQL*Plus!

Also check out another Oracle utility called yasql. You can find more information on it here: http://www.orafaq.com/wiki/YaSQL.


Last modified: 2017-1-8 (日) at 9:14 pm