While you are working on SQL*Plus and RMAN on Linux environment and you did some mistake and you want to edit your query it won’t work by default. There is way to configure it.
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. Here we are going to guide you how to install rlwrap and set it up for SQL*Plus and RMAN.
For installation you need to configure the EPEL yum repository or download manually and install it.
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
For Oracle Linux you can use below command.
[root@dbatrainings ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
OR
Installing rlwrap 7.6, requires python34 local install
[root@dbatrainings ~]# yum install rlwrap
Optional.
Configure aliases in .bash_profile so that rlwrap gets enabled when you start the command
alias sqlplus=”rlwrap sqlplus”
alias dgmgrl=”rlwrap dgmgrl”
alias rman=”rlwrap rman”
alias lsnrctl=”rlwrap lsnrctl”
alias asmcmd=”rlwrap asmcmd”
alias adrci=”rlwrap adrci”
alias impdp=”rlwrap impdp”
alias expdp=”rlwrap expdp”
[oracle@dbatrainings ~]$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle
[oracle@dbatrainings ~]$ rlsqlplus / as sysdba
SQL> select name, open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
ORCL READ WRITE
SQL> select name, open_mode from v$database;
Alternate way you can use without bash profile as well.
[oracle@dbatrainings ~]$ alias rlsqlplus='rlwrap sqlplus'
[oracle@dbatrainings ~]$ rlsqlplus / as sysdba
SQL> select name, open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
ORCL READ WRITE
SQL> select name, open_mode from v$database;
If you like and working for you you can share with others.
Comments