Installing rlwrap on linux: Easy step-by-step Guide

Installing rlwrap on linux

I will provide a detailed guide on Installing rlwrap on linux in this article. We’ll walk you through each step of the process with proper screenshots.

The rlwrap (readline wrapper) utility helps to access the command history and edit keyboard inputs in SQL*Plus, RMAN, and ASMCMD.

This article explains how to install rlwrap and set it up for SQL*Plus, RMAN, and ASMCMD.

1.First download the rlwrap utility from Fedora by running the below command as root user. If you are using RAC or data guard environment then download it on every node/server:

Here I am downloading it in my RAC environment:

[root@node1 ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
warning: /var/tmp/rpm-tmp.wlHBBs: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:epel-release-7-14 ################################# [100%]

[root@node2 ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
warning: /var/tmp/rpm-tmp.BonPsn: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:epel-release-7-14 ################################# [100%]

2. Now Install rlwrap utility in both nodes(In my example node1 and node2) as root user:

[root@node1 ~]# yum install rlwrap
Installed:
rlwrap.x86_64 0:0.45.2-2.el7
Dependency Installed:
perl-File-Slurp.noarch 0:9999.19-6.el7 python3.x86_64 0:3.6.8-21.0.1.el7_9 python3-libs.x86_64 0:3.6.8-21.0.1.el7_9
python3-pip.noarch 0:9.0.3-8.0.3.el7 python3-setuptools.noarch 0:39.2.0-10.0.1.el7
Complete!


[root@node2 ~]# yum install rlwrap
Installed:
rlwrap.x86_64 0:0.45.2-2.el7
Dependency Installed:
perl-File-Slurp.noarch 0:9999.19-6.el7 python3.x86_64 0:3.6.8-21.0.1.el7_9 python3-libs.x86_64 0:3.6.8-21.0.1.el7_9
python3-pip.noarch 0:9.0.3-8.0.3.el7 python3-setuptools.noarch 0:39.2.0-10.0.1.el7
Complete!

3. Edit the bash profile for the Oracle and grid user in both nodes if you want to use it by default otherwise you can run the commands(rlwrap sqlplus, rlwrap rman, and rlwrap asmcmd) manually whenever you want to use it. In my case, I will make it default for oracle and grid users by editing the bash profiles for both.

Edit Oracle bash profile as Oracle user:

NODE1:
=====
vi ~oracle/.bash_profile

## Do not modify any lines just at the end of the file add the below lines
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=racdb1
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'

press Esc and type :wq! to save the profile.
Reload the profile by running the below command:
. ~oracle/.bash_profile

NODE2:
=====

vi ~oracle/.bash_profile
##Do not modify any lines just at the end of the file add the below lines

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=racdb2
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'

press Esc and type :wq! to save the profile.
Reload the profile by running the below command:
. ~oracle/.bash_profile

Edit grid bash profile as grid user. If you are not using RAC databases/ grid home then you do not have to do anything for the grid user. For the standalone databases, there is only one node so you have to modify the bash profile only in one node/server as an Oracle user.

NODE1:
=====

vi ~grid/.bash_profile
##Do not modify any lines just at the end of the file add the below lines

export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=+ASM1
alias sqlplus='rlwrap sqlplus'
alias asmcmd='rlwrap asmcmd'

press Esc and type :wq! to save the profile.
Reload the profile by running the below command:
. ~grid/.bash_profile

NODE2:
======

vi ~grid/.bash_profile
##Do not modify any lines just at the end of the file add the below lines

export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=+ASM2
alias sqlplus='rlwrap sqlplus'
alias asmcmd='rlwrap asmcmd'

press Esc and type :wq! to save the profile.
Reload the profile by running the below command:
. ~grid/.bash_profile

So once you log in to the server as an Oracle or grid user, the above profiles will be set automatically and you can take the benefits of rlwrap installation.

Leave a Reply