Category Archives: SQL

Command line history in SQL (for Linux)…

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