How To Get Command History In sql*plus

sql*plus does not have a command history function under Linux and Unix. Lately I listened to Tom Kyte at one of his seminars he delivered in September in Zurich. He used a virtual Linux machine and had a command history for his sql*plus obviousely. He told us that he used a utility called rlwrap for this. rlwrap is a readline wrapper for shell commands which uses input from the controlling terminal. It adds a persistent input history for each command and supports user-defined completion.
Under Ubuntu, you can install rlwrap by:
$ sudo apt-get install rlwrap

And, you can start sqlplus:
$ rlwrap sqlplus username/password@server

Finally, the following alias in .bashrc will allow you to start sqlplus as normal with rlwrap turned on by default:
alias sqlplus='rlwrap sqlplus'

Source

No comments

Post a Comment