Command Line Tools and History
Posted by Harald van Breederode on January 17, 2009
While teaching an Oracle Data Guard course last week one of my students asked me how it was possible that I could recall commands in command line tools such as DGMGRL, SQL*Plus and RMAN. I told him that I use rlwrap For this purpose. I was quite surprised that he didn’t knew this because I wrote an article about this for the October 2008 issue of the Oracle University Technology Newsletter. In SQL*Plus’s Forgotten History I explain everything you need to know about this little but very useful utility. Personally I feel disabled when rlwrap is not available on systems I have to work on and it is usually the first thing I recommend to install. Besides making my life easier it also leaves a trail behind with the actions I performed.
-Harald
Surachart said
that’s a great tool…
thank you
Martijn said
Nice handy tool! Did not know it until now.
Thanks.
jarneil said
Is there any mileage in saying that maybe sqlplus should have some developer love and come with command history/completion by default, rather than the poor dba having to add a 3rd party piece of software?
cheers,
jason.
Harald van Breederode said
jason,
Thank you. Yes there is but this sounds easier than it is. SQL*Plus runs on many different platforms and on some of them adding command line editing and history would be quite a challenge. And if SQL*Plus would have this feature, we want this on all command line tools wouldn’t we? With all focus on GUI tools I don’t expect this will change soon if at all.
-Harald
Robert Klemme said
For the record: the Windows version of SQL Plus *does* have command line history – albeit no completion. You need to use the shell version though and not the Windows program.
Cheers
robert
Harald van Breederode said
Robert,
Thank you for this addition. Starting with Oracle11g the Windows SQL*Plus (sqlplusw.exe) is no longer available, only the shell version (sqlplus.exe) is included. Although sqlplus.exe does have history it is not persistent across sessions.
-Harald
KC said
Hi Harald,
I installed it on our Linux part of my MOT software. Works nice.
Dik Pater said
Harald,
on hpux unix you have ied.
if you type
$ ied sqlplus
you also have a history, you can even use a histfile.
Thanks for the tip.
Dik
Dik Pater said
Harald,
from windows commandtool :
cmd
sqlPlus >
sql > select * from dual ;
F7 for the history
F8 for completion of your statement.
Linux of windows….that’s the question…
Dik
KC said
And of course, I had some problems with Linux, 32 or 64 bit version.
The rlwrap 64 version didn’t work on OS 32: cannot execute [Exec format error]
The rlwrap 32 version didn’t work on OS 64: Floating point exception
Therefore:
by checking OS version (uname -m) I can decide what rlwrap to install on OS:
unix_version=`uname -m`
case “$unix_version” in
‘i386′|’i686′) bit_version=32
;;
*) bit_version=64
;;
esac
Pure DBA Science – some good postings « ocpdba oracle weblog said
[...] “Command Line Tools and History” – by Harald van Breederode [...]
Log Buffer #132: a Carnival of the Vanities for DBAs « Lisa Dobson said
[...] More good news as Harald van Breederode tells us it is possible to recall command line history in tools such as SQL*Plus. [...]
Chakrit said
Thank you!