Oracle and more - Amardeep Sidhu

My experiences with technology…

Archive for May 4th, 2007

Command line history in SQL (for Linux)…

Posted by Sidhu on 4th May 2007

Found a very interesting article on Dizwell’s blog. It was about keeping history of the SQL commands in SQL Plus on Linux. It is almost very simple. Just need to download a small utility called rlwrap from here. Its a tar.gz file. Download it, un-tar using


tar -xvf rlwrap-0.28.tar.gz

It will create a directory with the same name. cd to the directory and run


./configure

Now do


make install

(I was logged in as oracle user, then did su, but it gave some errors, finally I logged in as root and it worked fine)

Now what is left to be done is make an alias for sqlplus as


alias sqlplus='rlwrap sqlplus'

Using up/down arrows, commands can be scrolled up and down just like windows. Have a look at full article here.

Cheers

Sidhu

Posted in SQL, Unix/Linux | Comments Off