Flexible Sqlplus command line history with RLWRAP

At Hotsos Symposium Training Day I used rlwrap with sqlplus – which gives nice command line editing and history capabilities for tools like sqlplus. Additionally I pre-generated commonly used Oracle keywords, data dictionary view and package names into rlwrap wordfile, so I got nice tab-completion too. Sqlplus sucks much less with rlwrap ;-)

It’s relatively easy to install rlwrap on Unix (there are rlwrap RPMs out there, Solaris freeware packages and I installed it on Mac via macports.org). Just google around…

You can have rlwrap on Windows too – As rlwrap has been coded for Unix flavors, then on Windows you need to run it on a Unix library environment emulator – like Cygwin.

Dave Herring and Michael Paddock have both written an article about how to get rlwrap & sqlplus running on Windows, check out the articles here. It’s worth reading both as they have different additions…

So, if you want command line history, search and tab completion for sqlplus on Unix flavors or Windows, check these articles out!



This entry was posted in Cool stuff, Oracle, Productivity and tagged , . Bookmark the permalink.

9 Responses to Flexible Sqlplus command line history with RLWRAP

  1. rnm1978 says:

    ied does a similar thing on HP-UX

  2. This is a lesson I took well to heart at the Hotsos Symposium. Although I have used rlwrap for some time now, I wasn’t aware of how powerful it really is.
    Like the others, I took the liberty to write some blog posts on this issue myself.
    Thanks for the info!

  3. Nigel says:

    Hi Tanel,

    I think you’ll find that blogging about rlwrap and SQL*Plus is a dangerous practice:


  4. Tanel Poder says:

    Ha! I don’t give a damn :)

  5. The more the merrier. Even with all these blog posts bouncing around, a lot of people still don’t use rlwrap. Even more use their terminals’ default settings and don’t even set -o vi!

  6. talek says:

    If you like Vim then sqlplus sucks even much less with VoraX: http://code.google.com/p/vorax/

  7. Sidney says:

    thanks Tanel! sqlplus with rlwrap is really appealing.
    a little supplement for using vi editing mode with rlwrap
    put “set editing-mode vi” into ~/.inputrc

  8. Tanel Poder says:

    i ended up liking the emacs mode (especially the CTRL+R) , but you can use the vi mode too… thanks

  9. Petros.Jovani_20160610 says:


    VORAX4, a powerful IDE for Oracle databases, built on top of the widely known Vim editor and Oracle SqlPLUS, is here : http://talek.github.io/vorax4/
    However, you need to take care of some dependencies VoraX relies on (not simply at all …) :
    Vim 7.3 or above is required. The 501 patch is mandatory. You may check to see if you have this patch using: :echo has(‘patch501’)
    Your Vim must have ruby support enabled. In order to check this you may execute :version and look for +ruby. The supported Ruby is 1.9.3 or higher, including Ruby 2.0. To check the Ruby version with which your VIM was compiled, you may run the following command: :ruby puts RUBY_VERSION CREAM configurations are not supported therefore a plain Vim should be used.
    Ruby 1.9.3 or higher. It must match however the ruby version with which your Vim was compiled. See above.
    The ruby vorax gem: gem install vorax –no-rdoc –no-ri This is just a convenient method to install Vorax prerequisites.
    A working Oracle client with SqlPLUS, which has to be available in the environment $PATH variable. An instant client with SqlPLUS should be just fine.
    Ensure you have filetype plugin on set in your .vimrc file

Leave a Reply

Your email address will not be published. Required fields are marked *