Enable keyboard scrollback and editing for SQLPlus

One of the biggest annoyances of SQLPlus is the lack of any inline keyboard editing, try pressing up like you would to access the last command run and you get a horrible ASCII character. rlwrap is your saviour! rlwrap is a small license free program that adds inline editing commands and scrollback to any program including SQLPlus. It’s easy to setup, install via yum and use it to invoke sqlplus via the command line.

Installation

Setup access to the EPEL yum repositories. You’ll need the correct one for your O/S version which can be found here, but here’s an example using OEL7:

# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -Uvh epel-release-latest-7.noarch

Once that is setup, install rlwrap:

# yum install rlwrap

 

Usage

You can now invoke SQLPlus with rlwrap manually:

# rlwrap sqlplus

Or better still, add an alias to your .bash_profile so it does it automatically:

alias sqlplus='rlwrap sqlplus'

Next time you access SQLPlus from the command line using the default command it’ll open with full inline editing.

Leave a Reply