部署rlwrap軟體

龍山游龍發表於2016-01-11
對DBA而言,手動敲命令是家常便飯,本次研究rlwrap,在linux作業系統上,執行SQL*Plu或者RMAN的時候,可以使用向上,向下鍵來跳回之前已經執行過的SQL語句.你可以根據需要修改他們,然後按Enter鍵重新提交執行.可以大大的提高效率.然而,當在Linux Shell中執行SQL*Plus的時候,系統本身並不提供瀏覽歷史命令列的功能.為了在Linux中達到同樣的目的,可以安裝rlwrap,這個程式本身是個Shell,可以執行任何你提供給它的命令包括引數,並新增命令歷史瀏覽功能.

一、安裝readline包(ISO自帶)
[root@xuh ~]# yum list|grep readline-devel*
Unable to read consumer identity
readline-devel.i386                         5.1-3.el5                  base     
readline-devel.x86_64                       5.1-3.el5                  base     
[root@xuh ~]# yum install readline-devel* -y
[root@xuh ~]# yum list|grep readline-devel*
Unable to read consumer identity
readline-devel.i386                         5.1-3.el5                  installed
readline-devel.x86_64                       5.1-3.el5                  installed

二、下載rlwrap軟體包
~hlub/uck/rlwrap/
[root@xuh ~]# ls -rtl|grep rlwrap
-rw-r--r-- 1 root root 279608 Aug 21 14:32 rlwrap-0.42.tar.gz

三、安裝rlwrap包
[root@xuh ~]# gunzip rlwrap-0.42.tar.gz
[root@xuh ~]# tar -xvf rlwrap-0.42.tar
[root@xuh ~]# cd rlwrap-0.42
[root@xuh rlwrap-0.42]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
.
checking that generated files are newer than configure... done
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating filters/Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating doc/rlwrap.man
config.status: creating config.h
config.status: executing depfiles commands
Now do:
    make (or gmake)  to build rlwrap
    make check       for instructions how to test it
    make install     to install it
[root@xuh rlwrap-0.42]# make
[root@xuh rlwrap-0.42]# make check
[root@xuh rlwrap-0.42]# make install

四、新增環境變數
[oracle@xuh ~]$ vi .bash_profile
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
[oracle@xuh ~]$ source .bash_profile

部署了rlwrap,就可以透過上下鍵來跳回之前已經執行過的SQL語句,提高效率

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30310891/viewspace-1974755/,如需轉載,請註明出處,否則將追究法律責任。

相關文章