oracle使用小技巧,Oracle在linux下使用小技巧
1.?rlwrap 的安裝使用(已經在linux5企業版上驗證)
在Windows操作系統上,當在DOS命令窗口中運行SQL*Plus的時候,可以使用向上,向下鍵來跳回之前已經執行過的SQL語句.你可以根據需要修改他們,然后按Enter鍵重新提交執行.然而,當在Linux Shell中運行SQL*Plus的時候,并不提供瀏覽歷史命令行的功能.為了在Linux中達到同樣的目的,你可以安裝rlwrap,這個程式本身是個Shell,可以運行任何你提供給它的命令包括參數,并添加命令歷史瀏覽功能.The rlwrap program is under the GPL license.
一:安裝readline
oOS的安裝光盤里提供了readline包. 或者:URL: http://tianya23.blog.51cto.com/p_w_upload/200912/1081650_1261836999.zip
【注意】以下的安裝操作必須在root權限下執行
[root@oracle11g ~]# rpm -ivh readline*
error: Failed dependencies: libtermcap-devel is needed by readline-devel-5.1-1.1.i386.rpm
[root@oracle11g ~]# rpm -ivh libtermcap-devel-2.0.8-46.1.i386.rpm
[root@oracle11g ~]# rpm -ivh readline*
package readline-5.1-1.1 is already installed
[root@oracle11g ~]# rpm -ivh readline-devel-5.1-1.1.i386.rpm
如果出現以下問題,表示已經安裝了readline相關的軟件包,繼續以后的安裝即可。
[Intranet root@qa13620 /home/oracle/software]
#rpm -ivh readline-*
warning: readline-5.1-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...????????????????????????????????########################################### [100%]
file /usr/lib/libhistory.so.5.1 from install of readline-5.1-3.el5.i386 conflicts with file from package readline-5.1-1.1.i386
file /usr/lib/libreadline.so.5.1 from install of readline-5.1-3.el5.i386 conflicts with file from package readline-5.1-1.1.i386
二:安裝rlwrap
URL: http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.34.tar.gz
[root@oracle11g ~]# tar -zxvf rlwrap-0.30.tar.gz
[root@oracle11g ~]# cd rlwrap-0.30
[root@oracle11g rlwrap-0.30]# ./configure
[root@oracle11g rlwrap-0.30]# make
[root@oracle11g rlwrap-0.30]# make install
[root@oracle11g rlwrap-0.30]# rlwrap
Usage: rlwrap [options] command ...
Options:
-a[password:]????????????? --always-readline[=password:]
-A???????????????????????? --ansi-colour-aware
-b ???????????????? --break-chars=
-c???????????????????????? --complete-filenames
-C ??????????????? --command-name=
-D <0|1|2>???????????????? --history-no-dupes=<0|1|2>
-f ?????? --file=
-F ???????? --history-format=
-h???????????????????????? --help
-H ????????????????? --history-filename=
-i???????????????????????? --case-insensitive
-l ????????????????? --logfile=
-n???????????????????????? --no-warnings
-p[ANSI colour spec]?????? --prompt-colour[=ANSI colour spec]
-P ???????????????? --pre-given=
-q ???????????????? --quote-characters=
-m[newline substitute]???? --multi-line[=newline substitute]
-r???????????????????????? --remember
-v???????????????????????? --version
-s ???????????????????? --histsize= (negative: readonly)
-t ????????????????? --set-term-name=
【注意】如果出現rlwrap: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory
解決方案:
然后裝一個rlwrap解決上下鍵的問題,
可是運行后,老是出現
rlwrap: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory
找了一大幫資料,最后終于搞定
解決方法:
把libreadline.so.5所在lib位置加入到/etc/ld.so.conf文件當中
只要在/etc/ld.so.conf中加入/usr/local/lib這一行,
一般都可以解決此問題,不僅僅是對于libreadline.so.5,大部
分的so都存在這/usr/local/lib這個目錄里面。即:
[root@136_20 /home/oracle/software/rlwrap-0.34]
#cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
最后將/etc/ld.so.conf保存后,還要執行ldconfig 才會使更改生效
添加到profile文件中: vi /u01/oracle/.bash_profile
添加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
三:使用rlwrap
使用向上鍵調回最后執行的命令,按Enter鍵重新執行或修改后按Enter鍵執行.
解決在sqlplus下輸錯命令后正常刪除的方法
添加到profile文件中:?vi /u01/oracle/.bash_profile
添加
stty erase ^h
總結
以上是生活随笔為你收集整理的oracle使用小技巧,Oracle在linux下使用小技巧的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python脚本迁移数据库_Django
- 下一篇: linux 其他常用命令