'rman' cheat-sheet and rlwrap completion

Posted by katsumii on Oracle Blogs See other posts from Oracle Blogs or by katsumii
Published on Tue, 4 Dec 2012 00:08:16 +0000 Indexed on 2012/12/04 5:13 UTC
Read the original article Hit count: 601

Filed under:

I started using 'rlwrap' some monthes ago like one of my colleague does.

bash-like features in sqlplus, rman and other Oracle command line tools (Oracle Luxembourg Core Tech' Blog by Gilles Haro)

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.

There is 'rman' keyword file in the link above.
I experimented a little and found some missing keywords which are:

MAXCORRUPTION PRIMARY NOCFAU VIRTUAL COMPRESSION FOREIGN

With these words added, 'rman' works like this:

$ rlwrap -f ~/rman $ORACLE_HOME/bin/rman
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Dec 3 02:56:04 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
RMAN>  <-- Hit TAB
Display all 211 possibilities? (y or n)

As you can guess, this completion is not context aware.

I found these missing words by creating a kind of 'cheat sheet' for rman with the script like below.
This sheet contains list of verbs and 1st operands.
I uploaded to here so one can create a coffee cup with a lot of esoteric words printed on :)

validWords() {
  sed -n 's/^RMAN-01009: syntax error: found "identifier": expecting one of: //p' \
  | sed -r 's/double-quoted-string, single-quoted-string/Some String/;s/, /" "/g;s/""//'
}
echo "Bogus" | rman | validWords > /tmp/rman.$$
for i in $(cat /tmp/rman.$$)
do
  i=$(echo $i | tr -d '"')
  echo "#### $i ####"
  echo "$i Bogus" | rman | validWords
done

One can find more keywords in the document here.

© Oracle Blogs or respective owner

Related posts about /Misc