最近在Linux虚拟机上安装了Oracle来学习,在使用sqlplus的时候发现,linux下的sqlplus,退格键和方向键显示乱码,使用不便。查阅了一些资料,设定好了。
【1】退格键
[oracle@rhel ~]$ cd /home/oracle
[oracle@rhel ~]$ vi .bash_profile
#添加
【2】方向键
下载rlwrap的rpm包,以root身份安装,地址:http://rpm.pbone.net
[root@rhel opt]# ls
database linux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip ORCLfmap rlwrap-0.37-1.el5.i386.rpm
[root@rhel opt]# rpm -ivh rlwrap-0.37-1.el5.i386.rpm
warning: rlwrap-0.37-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:rlwrap ########################################### [100%]
安装完成以后,切换到oracle用户,登录sqlplus
[oracle@rhel ~]$ rlwrap sqlplus /nolog
这样方向键就正常了。但是每次登录都要添加 rlwrap,不方便,所以可以使用下面的方式将sqlplus设定为rlwrap sqlplus 的别名。
[oracle@rhel ~]$ cd /home/oracle
[oracle@rhel ~]$ vi .bashrc (.bash_profile亦可)
#添加
alias sqlplus='rlwrap sqlplus' --设定别名
然后,source ~/.bashrc,使参数生效
【1】退格键
[oracle@rhel ~]$ cd /home/oracle
[oracle@rhel ~]$ vi .bash_profile
#添加
stty erase ^H --退格
stty erase ^? --问号
【2】方向键
下载rlwrap的rpm包,以root身份安装,地址:http://rpm.pbone.net
[root@rhel opt]# ls
database linux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip ORCLfmap rlwrap-0.37-1.el5.i386.rpm
[root@rhel opt]# rpm -ivh rlwrap-0.37-1.el5.i386.rpm
warning: rlwrap-0.37-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:rlwrap ########################################### [100%]
安装完成以后,切换到oracle用户,登录sqlplus
[oracle@rhel ~]$ rlwrap sqlplus /nolog
这样方向键就正常了。但是每次登录都要添加 rlwrap,不方便,所以可以使用下面的方式将sqlplus设定为rlwrap sqlplus 的别名。
[oracle@rhel ~]$ cd /home/oracle
[oracle@rhel ~]$ vi .bashrc (.bash_profile亦可)
#添加
alias sqlplus='rlwrap sqlplus' --设定别名
然后,source ~/.bashrc,使参数生效