Linux中安裝完Oracle後,預設的 sqlplus
上下鍵是不能用的,安裝了 rlwrap
之後就能通過上下鍵翻回曆史命令了
- 安裝readline 及 依賴
[root@ogg1 rlwrap-0.43]# yum install readline*
已載入外掛:fastestmirror, refresh-packagekit, security
設定安裝程式
Loading mirror speeds from cached hostfile
包 readline-6.0-4.el6.x86_64 已安裝並且是最新版本
解決依賴關係
--> 執行事務檢查
---> Package readline-devel.x86_64 0:6.0-4.el6 will be 安裝
---> Package readline-static.x86_64 0:6.0-4.el6 will be 安裝
--> 完成依賴關係計算
依賴關係解決
===============================================================================================================================================================
軟體包 架構 版本 倉庫 大小
===============================================================================================================================================================
正在安裝:
readline-devel x86_64 6.0-4.el6 base 134 k
readline-static x86_64 6.0-4.el6 base 113 k
事務概要
===============================================================================================================================================================
Install 2 Package(s)
總下載量:248 k
Installed size: 790 k
確定嗎?[y/N]:y
下載軟體包:
(1/2): readline-devel-6.0-4.el6.x86_64.rpm | 134 kB 00:00
(2/2): readline-static-6.0-4.el6.x86_64.rpm | 113 kB 00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------
總計 231 kB/s | 248 kB 00:01
執行 rpm_check_debug
執行事務測試
事務測試成功
執行事務
正在安裝 : readline-devel-6.0-4.el6.x86_64 1/2
正在安裝 : readline-static-6.0-4.el6.x86_64 2/2
Verifying : readline-static-6.0-4.el6.x86_64 1/2
Verifying : readline-devel-6.0-4.el6.x86_64 2/2
已安裝:
readline-devel.x86_64 0:6.0-4.el6 readline-static.x86_64 0:6.0-4.el6
完畢!
- 上傳、解壓、編譯、安裝rlwrap
[root@ogg1 ~]# tar -zxvf rlwrap-0.43.tar.gz
[root@ogg1 ~]# cd rlwrap-0.43
[root@ogg1 rlwrap-0.43]# ./configure && make && make install
- 配置shell
[root@ogg1 rlwrap-0.43]# su - oracle
[oracle@ogg1 ~]$ vim .bash_profile
最後增加以下配置,使oracle相關命令都支援回退和上下鍵
alias sqlplus=`rlwrap sqlplus`
alias rman=`rlwrap rman`
alias lsnrctl=`rlwrap lsnrctl`
- 其它問題
- checking build system type…
Invalid configurationx86_64-unknown-linux-`: machine
x86_64-unknown-linux`not recognized
configure: error: /bin/sh tools/config.sub x86_64-unknown-linux- failed
解決:需要安裝GCC,執行命令:yum install -y gcc
- You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/) to build this program!
解決:需要安裝libtermcap-devel,執行命令:yum install -y libtermcap-devel 實際上RLwrap的安裝需要兩個依賴包:readline和libtermcap-devel readline一般都會整合在Linux裡,所以這裡直接安裝libtermcap-devel
- bash: make: command not found
解決:需要安裝make,執行命令:yum install -y make*