Monday, August 31, 2015

Install rlwrap to enable command line history with sqlplus and rman

7:03 AM Posted by Dilli Raj Maharjan , No comments

Download rlwrap package

wget http://freecode.com/urls/de7d8482e030110354012880805e76fd















Extract rlwrap source with command below.

tar xzvf rlwrap-0.41.tar.gz 














Change directory to extracted source. Configure it, make it and install it with commands below.


[root@oel1 dilli]# cd rlwrap-0.41
[root@oel1 rlwrap-0.41]# ./configure
[root@oel1 rlwrap-0.41]# 
[root@oel1 rlwrap-0.41]# make 
[root@oel1 rlwrap-0.41]# 
[root@oel1 rlwrap-0.41]# make install











Now create alias so that alias will execute rlwrap with sqlplus and rman as an argument. Include it on profile so that this alias will be executed for all the users.


[root@oel1 rlwrap-0.41]# cd /etc/profile.d/
[root@oel1 profile.d]# cat > oracle.sh
alias rsqlplus='rlwrap sqlplus'
alias rrman='rlwrap rman'
^C
[root@oel1 profile.d]# chmod 755 oracle.sh 












Now login to sqlplus as rsqlplus

rsqlplus scott













Execute SQL command

select count(*) from emp;









Now SQL command is saved on history. We can recall commands executed with UP Arrow.



0 comments:

Post a Comment