How to make sqlplus more friendly

Jephe Wu - http://linuxtechres.blogspot.com

Objective: to solve some issues with sqlplus such as backspace and command history
Environment: CentOS 5.5 64bit, Oracle 11g 64bit, putty or Xshell ssh client


Steps:
1. History command

Original sqlpuls doesn't support history commands, you can use rlwrap.

a. download rlwrap from http://utopia.knoware.nl/~hlub/rlwrap/
b. tar xvpfz rlwrap-0.37.tar.gz
c. ./configure; make; make install

2. put the following into ~oracle/.bash_profile
stty erase ^H  (ctrl + V, then H)
# for some ssh client, you might need to use stty erase '^?' (that's shift+6+?)
alias sqlplus='rlwrap sqlplus'

3. run sqlplus normally
like sqlpluls / as sysdba, now you can easily use history commands and move cursors