国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

利用uniread 解決 Linux下的SQL*Plus 命令行歷史回調(diào)功能

2024-07-21 02:08:29
字體:
供稿:網(wǎng)友

利用uniread 解決 linux下的sql*plus 命令行歷史回調(diào)功能

作者: fenng


大家知道, 在 windows 平臺 命令行中的 sql*plus 有命令行歷史回調(diào)的功能,在sql*plus工具下面,可以利用鍵盤的
"向上向下"箭頭鍵對命令行的進行回調(diào).而在linux上則沒有該功能(雖然 shell 可以做到這一點,但是 sql*plus 不可以).
而該功能對于cli愛好者來說幾乎是不可缺的,不知道為什么 oracle 不把這個功能加進來.不得而知了.

一些sql*plus 的替代產(chǎn)品(如 gqlplus 以及yasql)具備command-line editing 和command history的功能, 但是這
些產(chǎn)品的開發(fā)進度較慢--有的甚至已經(jīng)停止了更新.

(參見: gqlplus http://sourceforge.net/projects/gqlplus 以及 yasql http://sourceforge.net/projects/yasql/
等 sql*plus 替代工具 ).

在網(wǎng)絡(luò)上閑逛的時候, 發(fā)現(xiàn)了一個在linux下面的解決辦法, 現(xiàn)在和大家共享.

該工具叫做uniread ( http://sourceforge.net/projects/uniread/ ) ,熟悉linux下變成的朋友可能看到這個名字已經(jīng)
想起了一些東西:readline . 不錯,該工具就是利用gnu的readline庫來完成我們的需求的.

我們先看一下對該工具的介紹:

uniread - universal readline - adds full readline support (command editing, history, etc.) to any existing
interactive command-line program. common examples are oracle's sqlplus or jython. uniread will work
on any posix platform with perl.

可以看出,該工具可以對任何既有的交互命令行程序都可提供完備的readline支持.

從該站點下載源程序.目前的穩(wěn)定版本是1.01.

在安裝該工具之前系統(tǒng)必須安裝好perl, 此外還必須要三個工具包:

gnu readline
http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html

term::readline::gnu
http://search.cpan.org/dist/term-readline-gnu/

io::tty
http://search.cpan.org/dist/io-tty/

其中g(shù)nu readline 上面的網(wǎng)頁在我的機器上打不開(不可訪問?),如果你也是同樣情況,可以到
http://www.gnu.org/directory/readline.html 這個頁面下載.

下載后,首先解壓縮:

# tar -xzvf readline-4.3.tar.gz

進入進入到該目錄中編譯并安裝:

# ./configure
# make
# make install

后面兩個的安裝: tar -zxvf ....
進入到該目錄中:

# perl makefile.pl
# make
# make install

都安裝完了之后,進行 uniread 的安裝:

#tar -xzvf uniread-1.01.tar.gz
#cd uniread-1.01
#./configure
#make
#make install

注: 以上的命令行操作所在絕對路徑為了方便而省略,你的環(huán)境肯定會和我的不同,此外,建議使用普通用戶編譯,然后用 root 進行
make install .

都安裝完了之后
切換到oracle用戶下:

$ uniread sqlplus /nolog

輸出類似如下:

[uniread] loaded history (12 lines) //我的已經(jīng)運行一次了,uniread 緩沖了12行history

sql*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>


查看uniread的manual:

$man uniread


你可以做個sqlplus 的別名 ,uniread的使用是透明的,是不是很方便了? 不要忘了:這個工具是有通用性的,不止是 sql*plus
可以這樣用,其他類似的命令行程序也能如此的.


參考內(nèi)容:

uniread的站點 http://sourceforge.net/projects/uniread

gnu 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."

目前還算萬能的google http://www.google.com





原文出處:
<a >http://www.dbanotes.net/oracle/uniread-howto.htm</a>

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 龙游县| 桓台县| 扬中市| 通州区| 集安市| 衡南县| 宝丰县| 永修县| 泰来县| 县级市| 西昌市| 嵊泗县| 澄迈县| 榆中县| 靖州| 金寨县| 忻城县| 富蕴县| 油尖旺区| 南昌县| 安庆市| 安达市| 大宁县| 河间市| 张北县| 昌吉市| 镇宁| 罗山县| 新建县| 曲麻莱县| 宜川县| 龙岩市| 蕉岭县| 抚顺县| 通江县| 台北市| 宁明县| 大庆市| 手机| 高雄市| 平邑县|