oracle read line wrap(rlwrap)安裝

相信不少初學Oracle的同仁都有這樣一個問題,在使用sqlplus或者rman工具的時候,苦於不能左右移動光標,或者不能上下翻看命令歷史,跟Linux文本模式相比,實在不通人情。 php

    好在開源的Linux奇妙無比,總有那麼一些人,俠骨柔情,救廣大網民與水深火熱之中,開發出一個個巧妙的做品,供各位使用把玩。readline wrap(rlwrap)就是這樣的一個工具,sqlplus和rman中不能左右移動光標,不能上下翻看命令歷史的問題,能夠很好的解決。 sql

    rlwrap的安裝很簡單,下面作簡單的介紹。 bash

首先下載安裝包: oracle

http://utopia.knoware.nl/~hlub/uck/rlwrap/ 這裏下載rlwrap-0.37.tar.gz (248 k) 工具

使用RedHat EL的同仁們,能夠到以下地址下載rpm包: .net

http://rpm.pbone.net/index.php3/stat/4/idpl/14484200/dir/redhat_el_5/com/rlwrap-0.3 regexp

   能夠根據須要,選擇本身的偏好,這裏以gz格式的安裝爲例: 開發

    須要的gz包下載好後,上傳到目的機器上的/tmp目錄,能夠用CRT工具的SFTP工具,或者Xmanager的xftp工具,我的比較喜歡xftp,圖形化界面,而且能夠方便的上傳下載文件夾。 get

#cd /tmp input

確認文件存在

#ls  rlwrap-0.37.tar.gz 

解壓:

#tar -zxvf rlwrap-0.37.tar.gz 
#cd rlwrap-0.37
#ls
其中能夠看到configure文件,運行之:
#./configure
   若是有必須的依賴包沒有安裝,會在最後提示安裝,通常是
   rlwrap-devel包,能夠根據狀況,本身找找,安裝好
進行編譯安裝
#make
#make install
安裝好後,能夠在Oracle用戶下驗證安裝
#su - oracle
#rlwrap
Usage: rlwrap [options] command ...
 
Options:
  -a[password:]              --always-readline[=password:]
  -A                         --ansi-colour-aware
  -b  <chars>                --break-chars=<chars>
  -c                         --complete-filenames
  -C  <name|N>               --command-name=<name|N>
  -D  <0|1|2>                --history-no-dupes=<0|1|2>
  -f  <completion list>      --file=<completion list>
  -g  <regexp>               --forget-matching=<regexp>
  -h                         --help
  -H  <file>                 --history-filename=<file>
  -i                         --case-insensitive
  -I                         --pass-sigint-as-sigterm
  -l  <file>                 --logfile=<file>
  -n                         --no-warnings
  -N                         --no-children
  -o                         --one-shot
  -O  <regexp>               --only-cook=<regexp>
  -p[colour]                 --prompt-colour[=colour]
  -P  <input>                --pre-given=<input>
  -q  <chars>                --quote-characters=<chars>
  -m[newline substitute]     --multi-line[=newline substitute]
............
出現以上提示,說明安裝成功,若是提示命令未找到,那麼在PATH中,加入/usr/local/bin目錄
$PATH=/usr/local/bin:$PATH;export PATH
這裏,就能夠運行rlwrap sqlplus /nolog來啓動sqlplus了,能夠體驗readline的神奇功能。
固然,爲了一勞永逸,能夠在Oracle用戶的.bash_profile文件中,添加以下行:

alias sqlplus=’rlwrap sqlplus’

alias rman=’rlwrap rman’

這樣,跟以前運行sqlplus和rman沒有任何區別,只是,用起來要爽多了。

重要提示:即便退出sqlplus,從新進入,以前的命令一樣也能夠翻看。

如何,心動不如行動,更多好處,等你來分享。

相關文章
相關標籤/搜索