Chinaunix首页 | 论坛 | 博客
  • 博客访问: 438184
  • 博文数量: 94
  • 博客积分: 3066
  • 博客等级: 中校
  • 技术积分: 908
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-25 17:10
文章分类

全部博文(94)

文章存档

2016年(3)

2015年(4)

2014年(1)

2013年(9)

2012年(8)

2011年(1)

2010年(8)

2009年(4)

2008年(2)

2007年(6)

2006年(48)

我的朋友

分类:

2007-04-13 12:40:58

  • I’ve been trying to follow your advice and use Linux for my Oracle learning environment instead of Windows. But it’s practically unworkable! In Windows, I can up-arrow in SQL*Plus and retrieve old commands, make one or two edits and re-submit. But in Linux I can’t, I just have to type them in all over again from scratch. This is madness!!

I agree it’s madness, and it has driven me completely bonkers many a time, so you’re not alone. But you will be relieved to know that help is on its way, thanks to a former colleague of mine, Paul Burgess, for having discovered one of the nicest little utilities for Linux that I know of... and letting me in on the secret.

What you must get your hands on is a tiny program called RLWRAP. It’s only 24K in size, and you can download it . If you wish to check for a more up-to-date version (this document was written in November 2004), then try Once it's downloaded, install it as you would any rpm. That is, as root, issue the command

rpm -ivh rlwrap-0.18-1.i386.rpm

For the program to take effect, you must then edit the .bashrc file for the Oracle user (and any other user who is to run SQL*Plus regularly), so that it contains the lines:

alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'

...and if you want to put a command line history into any other Oracle program, you simply alias the program in the same way (hence: alias exp=’rlwrap exp’ for export, and alias lsnrctl=’rlwrap lsnrctl’ for the Listener Control utility and so on).

After that, you need to open a new terminal window so that the revised .bashrc gets invoked, and you can then run SQL*Plus (and any other program) as normal... only this time, you'll find that once you've issued a few commands, you'll be able to hit the up-arrow key to retrieve them.It will be as if Microsoft had never gone away!

Meanwhile, you will find that rlwrap can be made even more usable , if such a thing were possible, by the judicious use of Ctrl+R. This let's you search through the command line history, instead of just having to up- and down-arrow through it sequentially. As you type part of a command, the utility finds commands which match what you type. Bliss!

I love it. I notice Tom Kyte loves it. Strong DBAs have been known to go weak at the knees when they see it for the first time, and some have even shed a tear. 'Nuff said: it rocks!! If only it (or something like it) was built into SQL*Plus in the first place (hint, hint)!


阅读(1181) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~