Tuesday, September 13, 2016

Making up arrow key work for sqlplus, rman, dgmgrl, adrci

It is nice to have up arrow key working in sqlplus, rman, dgmgrl, adrci. But can this work.

YES !!! of course it can, I have tried it on Redhat.

Below are the steps to do this.
  1. Download the rlwrap package 
  2. Install the package
  3. Create the .aliases file
  4. Modify .bashrc
  5. WALLAH !!!
Download the rlwrap package 
I have downloaded rlwrap-0.42.tar.gz from http://utopia.knoware.nl/~hlub/uck/rlwrap/#rlwrap
or download the file by clicking link below

Install the package
the installation is done using 
su -
gunzip rlwrap*.gz
tar -xvf rlwrap*.tar
cd rlwrap*
./configure
make
make check
make install
Create the .aliases file
Added below lines in .aliases at oracle home directory in my case it was /home/oracle
alias adrci='/usr/local/bin/rlwrap $ORACLE_HOME/bin/adrci'
alias sqlplus='/usr/local/bin/rlwrap $ORACLE_HOME/bin/sqlplus'
alias dgmgrl='/usr/local/bin/rlwrap $ORACLE_HOME/bin/dgmgrl'
alias rman='/usr/local/bin/rlwrap $ORACLE_HOME/bin/rman'
Modify .bashrc
Modified the .bashrc file so that new .aliases is there. My file is 
[oracle@o12c (cdb1) ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
# User specific aliases and functions
if [ -f $HOME/.aliases ]
then
  . $HOME/.aliases
fi
[oracle@o12c (cdb1) ~]$ 
WALLAH !!!

Once above is done then create a new oracle connection to unix server and you are done. The up arrow key will start working.




No comments: