bash-like features in sqlplus, rman and other Oracle command line tools

Posted by Gilles Haro on Oracle Blogs See other posts from Oracle Blogs or by Gilles Haro
Published on Wed, 16 Mar 2011 06:11:00 +0000 Indexed on 2011/03/16 16:15 UTC
Read the original article Hit count: 257

Filed under:

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 davidw 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.
    • $HOME/.oracle_keywords
  • Create an alias for sqlplus
    • alias sqlplus='/usr/bin/rlwrap -if $HOME/.oracle_keywords $ORACLE_HOME/bin/sqlplus'

And enjoy it !!!

Thank you DavidW.

Gilles Haro
Technical Expert - Core Technology, Oracle Consulting 

IronManSignature_thumb

Technorati Tags:

© Oracle Blogs or respective owner