bash-like features in sqlplus, rman and other Oracle command line tools
By gharo on Mar 16, 2011
As far as I can remember, I have always been complaining about the lack of “recall last command” from within sqlplus. Such a basic thing, available in any bash shell or windows cmd terminal, remains missing with Oracle command lines tools.
Thanks to Arnaud who published a post in the french blog EASYTEAM, it is now possible to use a simple rpm package rlwrap to enhance sqlplus, dgmgrl, rman, … tools and give them bash “recall/completion” capabilities.
I installed it in a few minutes and I am already wondering how can people work without it.
The steps are here :
- Get the rpm file from sites like RPM PBone.
- AS root, install the package
- rpm -ivh rlwrap-0.37-1.el5.x86_64.rpm
- As Oracle, create a dictionnary file (for autocompletion) . This file is made of a series of words to be used for autocompletion. Put in it the list of dictionary tables, the list of sql commands, the list of sqlplus commands… whatever your like. And use the <tab> key as you would in a bash shell.
- Create an alias for sqlplus
- alias sqlplus='/usr/bin/rlwrap -if $HOME/.oracle_keywords $ORACLE_HOME/bin/sqlplus'
And enjoy it !!!
Thank you Arnaud.
Add: One can find specific Oracle extension for databases 9i, 10g and 11g (keyword textfile) over here.
This will avoid you the need to create this .oracle_keywords file.
Thank you Michael for this info.
Technical Expert - Core Technology, Oracle Consulting