溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Oracle下sqlplus無法使用命令退格刪除和歷史記錄的解決方法--使用rlwrap

發(fā)布時(shí)間:2020-04-28 12:52:42 來源:網(wǎng)絡(luò) 閱讀:1652 作者:xjsunjie 欄目:關(guān)系型數(shù)據(jù)庫

   

    一般通過SecureCRT或putty等SSH客戶端遠(yuǎn)程登錄Linux下oracle的時(shí)候,使用sqplus連接數(shù)據(jù)庫,輸錯(cuò)字符后按Backspace鍵或Del鍵刪除時(shí),會出現(xiàn)^H或其他亂七八糟的的字符,會感覺非常別扭不習(xí)慣,而且影響使用效率。針對此問題,小結(jié)了一下。

一、安裝相應(yīng)的軟件包

首先配置本地YUM源

然后

yum -y install readline*

Running Transaction

  Installing : ncurses-devel-5.7-3.20090208.el6.x86_64                               1/2 

  Installing : readline-devel-6.0-4.el6.x86_64                                       2/2 

Installed products updated.

  Verifying  : readline-devel-6.0-4.el6.x86_64                                       1/2 

  Verifying  : ncurses-devel-5.7-3.20090208.el6.x86_64                               2/2 

等待安裝完成

然后從網(wǎng)上下載rlwrap-0.37.tar包

[root@rac1 home]#tar -xvf  rlwrap-0.37.tar

[root@rac1 home]# cd rlwrap-0.37

[root@rac1 rlwrap-0.37]# ls -l

總用量 472

-rw-rw-r-- 1  500  500  35029 4月  30 2010 aclocal.m4

-rw-r--r-- 1  500  500    638 8月  15 2006 AUTHORS

-rw-r--r-- 1  500  500   4267 5月   5 2010 BUGS

-rw-r--r-- 1  500  500    105 8月  10 2003 ChangeLog

drwxrwxr-x 2  500  500   4096 5月   5 2010 completions

-rw-rw-r-- 1  500  500   7042 4月  30 2010 config.h.in

-rw-r--r-- 1 root root  67839 9月   1 17:00 config.log

-rwxr-xr-x 1  500  500 222847 4月  30 2010 configure

-rw-r--r-- 1  500  500  11521 4月  30 2010 configure.ac

-rw-r--r-- 1  500  500  17992 8月   8 2006 COPYING

drwxrwxr-x 2  500  500   4096 5月   5 2010 doc

drwxrwxr-x 2  500  500   4096 5月   5 2010 filters

-rw-r--r-- 1  500  500   2019 11月 23 2009 INSTALL

-rw-r--r-- 1  500  500   1272 1月  23 2010 Makefile.am

-rw-rw-r-- 1  500  500  28316 4月  30 2010 Makefile.in

-rw-r--r-- 1  500  500  16788 4月  30 2010 NEWS

-rw-r--r-- 1  500  500   1394 10月 24 2007 PLEA

-rw-r--r-- 1  500  500   3070 1月   8 2010 README

drwxrwxr-x 2  500  500   4096 5月   5 2010 src

drwxrwxr-x 2  500  500   4096 5月   5 2010 test

-rw-r--r-- 1  500  500    310 4月  16 2010 TODO

drwxrwxr-x 2  500  500   4096 5月   5 2010 tools

[root@rac1 rlwrap-0.37]# ./configure

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p


[root@rac1 rlwrap-0.37]# make

[root@rac1 rlwrap-0.37]# make install


二:配置使用rlwrap

[root@oracle11g rlwrap-0.30]# vi /home/oracle/.bash_profile

在首部或尾部添加

alias  sqlplus='rlwrap sqlplus'

alias  lsnrctl='rlwrap lsnrctl'

alias  rman='rlwrap rman'

stty erase ^h


如果出現(xiàn)rlwrap命令找不到,請配置PATH

PATH=$PATH:$HOME/bin:/home/rlwrap-0.37/src


使修改的變量執(zhí)行生效

# source .bash_profile



三.進(jìn)入oracle連接用戶測試

#su - oracle

sqlplus / as sysdba

SQL> show user

 

之后再用命令sqlplus / as sysdba 連接數(shù)據(jù)庫時(shí)就會調(diào)用rlwrap這個(gè)工具,使得Linux下的SQL Plus可以像Windows下的那樣使用了。


補(bǔ)充:如果sqlplus命令用不了,可以做如下設(shè)置

[oracle@rac1 ~]$ sqlplus /nolog

bash: sqlplus: command not found

[oracle@rac1 ~]$ ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

ln: creating symbolic link `/usr/bin/sqlplus' to `/bin/sqlplus': Permission deni ed

[oracle@rac1 ~]$ su - root

Password:

[root@rac1 ~]# ln -s $ORACLE_HOME/bin/sqlplus  /usr/bin

[root@rac1 ~]# su - oracle

[oracle@rac1 ~]$ sqlplus /nolog

SQL> conn / as sysdba

Connected to an idle instance.

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI