Use uniread to solve the SQL * Plus command line history callback function under Linux

zhaozj2021-02-16  45

Uniread use under Linux to solve the SQL * Plus command-line history of the callback function: Fenng

Everyone knows that SQL * Plus in the Windows Platform command line has the function of command line history. By the SQL * Plus tool, you can use the "Upward" arrow key of the keyboard to call the command line. And on Linux There is no such function (although shell can do this, but SQL * Plus is not). This feature is almost indispensable for CLI enthusiasts. I don't know why Oracle doesn't add this function. Don't know .

Some SQL * Plus alternatives (such as GQLPlus and Yasql) have the features of Command-Line Editing and Command History, but the development of these products is slower - some even stopped updating.

(See: gqlplus http://sourceforge.net/projects/gqlplus and Yasql http://sourceforge.net/projects/yasql/ and other SQL * Plus replacement tools). When you go online, I found a next under Linux. The solution is now shared with everyone. This tool is called uniread (http://sourceforge.net/projects/uniread/), familiar with Linux, may see that this name has already remembered something: readline. Good, This tool is to use the GNU's Readline library to complete our needs.

Let's take a look at the introduction to this tool:

uniread - universal readline - adds full readline support (command editing, history, etc.) to any existinginteractive command-line program Common examples are Oracle's sqlplus or jython uniread will work on any POSIX platform with Perl...

It can be seen that the tool can provide complete Readline support for any existing interactive command line programs.

Download the source from this site. The current stable version is 1.01.

Before installing the tool, the system must be installed, and there must be three kits:

GNU readlinehttp://cnswww.cns.cwru.edu/php/chet/readline/rtop.htmlterm :: Readline :: gnuhttp: //search.cpan.org/dist/term-readline-gnu/IO :: TTYHTTP: //search.cpan.org/dist/io-tty/

Where the web page above GNU Readline is not open on my machine (irresisible?), If you are also the same, you can go to http://www.gnu.org/directory/readline.html this page to download.

After downloading, first decompress: # tar -xzvf readline-4.3.tar.gz Enter into this directory to compile and install: # ./configure# make # make install

Back two installations: tar -zxvf .... Enter into this directory: # perl makefile.pl # make # make install

After installation, do uniread installation: #tar -xzvf uniread-1.01.tar.gz # cd uniread-1.01 #. / Configure # make # Make Install

Note: The above command line operation is the absolute path to omit, and your environment will definitely be different from me. In addition, it is recommended to compile ordinary users and then use root to make Make Install.

Switched to Oracle users after installation:

$ uniread SQLPLUS / NOLOG

The output is similar to:

[Uniread] loaded history (12 lines) // I have run once, UniRead buffered 12 lines HistorySQL * Plus: release 10.1.0.2.0 - Production on Sat Mar 6 00:23:05 2004

Copyright (C) 1982, 2004, Oracle. All Rights Reserved.

SQL>

View uniread's Manual:

$ man uniread

You can do a SQLPLUS alias, uniRead's use is transparent, is it very convenient? Don't forget: This tool is versatile, not only SQL * Plus can be used, other similar command line programs can also such references:. uniread site http://sourceforge.net/projects/unireadGNU readline http://www.gnu.org/directory/readline.html "the readline library provides a set of functions for use by applications that Allow Users to Edit Command Lines as They Are Typed in. "Currently Master's Google http://www.google.com

Original version: http://www.dbanotes.net/oracle/uniread-howto.htm

转载请注明原文地址:https://www.9cbs.com/read-27573.html

New Post(0)