8i | 9i | 10g | 11g | 12c | 13c | 18c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Linux » Here

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 to Lutz Hartmann for reminding me of this utility.

The SQL Developer team have a cool tool called SQLcl, that is like a Java-based SQL*Plus replacement with lots of extra functionality, including command history. The 12cR2 version of SQL*Plus now contains a command history.

Installation From EPEL

Configure the EPEL yum repository, as described here. In this case i was installing on Oracle Linux 6 (x86-64), so I downloaded the package displayed here. Don't worry that it is listed as a, i386 package. It just installs the yum repository. The following commands download and configure the EPEL repository.

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

For Oracle Linux 7 you would do this.

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

With the repository in place you can install rlwrap using the following command.

# yum install rlwrap

If you are using Oracle Linux 7 you can enable the "ol7_developer_EPEL" repository in the "/etc/yum.repos.d/public-yum-ol7.repo" file, which is a clone of EPEL provided by Oracle. You can the do a normal YUM install.

Manual Installation

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*
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:

For more information see:

Hope this helps. Regards Tim...

Back to the Top.