Very interesting features from http://www.linuxification.at/rlwrap_ext.html.en
rlwrap_ext
rlwrap-ext – an extension for rlwrap
Description
Using sqlplus, rman or any other Oracle command line tool combined with rlwrap can be even more convenient – rlwrap is full of some fancy features, e.g. command line completion. You type the keys sel
and when pressing the tab key rlwrap completes it to SELECT
.
Does not sound spectacular?
It isn’t, anyway, but quite useful. That´s the way rlwrap can do completion on the following things:
- all V$-views,
- the complete data dictionary (all DBA_-, ALL_- and USER_-views),
- all init-parameter (documented and undocumented),
- some useful tables,
- all DBMS_* und UTL_* -packages and
- all SQL-funktions
To make it work, you have to follow those steps:
- provide rlwrap with a file (maybe several files) containig all those nice keywords and
- tell rlwrap the delimiters for words. Since the readline Library was written for bash, it acknowledges by default the characters
$
and#
as word delimiters – which is wrong for SQL. So I wrote a script named sql+ to repair that. It is also in each package.
Download
You can download my extensions for three Oracle Versions:
- rlwrap-extensions for Oracle Version 9
- rlwrap-extensions for Oracle Version 10
- rlwrap-extensions for Oracle Version 11
All you have to do is: untar the package into /usr/local/share/rlwrap
and put the script sql+ somewhere into your path, like /usr/local/bin
. That’s it.
Which Version?
I created rlwrap-extensions for Oracle version 9i, 10g and 11g. They differ only in view names / packages names etc in the keyword lists. Since rlwrap does not care to which Oracle version it is talking to, it does not matter if you use rlwrap-extensions for a different Oracle Version. But if you really want each Oracle version to have its own rlwrap-version knowing the *EXACT* keyword list, do the following: Install each version of rlwrap-extensions in a separate directory and create an adapted version of the script sql+
(usually located in /usr/local/bin
. Put each version of that script into the appropriate $ORACLE_HOME/bin
. That’s it.
If in doubt, take the newest version.
Using Oracle command line tools with rlwrap-extensions
When calling rman, asmcmd or adrcli (the latter being available only in 11g) with rlwrap, use the switch -i to force rlwrap into case-insensitive mode. Otherwise it might not find the keywords in the lists.
rlwrap -i asmcmd
or
rlwrap -i rman target ...