数据库

 首页 > 数据库 > Oracle > 解决Sqlplus在Linux下光标乱码的方法

解决Sqlplus在Linux下光标乱码的方法

分享到:
【字体:
导读:
         摘要:Redhatenterpriselinux下安装rlwrap工具rlwrap可以用来支持oracle下sqlplus历史命令的回调功能,提高效率。安装rlwrap时,提示需要安装readline就用yuminstallreadline就可以了1、下载从http://ut... Sy...

解决Sqlplus在Linux下光标乱码的方法

Redhat enterprise linux下安装rlwrap工具
 
rlwrap 可以用来支持oracle下sqlplus历史命令的回调功能,提高效率。
安装rlwrap时,提示需要安装readline 
就用yum install readline 就可以了
 
1、  下载
从http://utopia.knoware.nl/~hlub/uck/rlwrap/下载rlwrap-0.37.tar.gz,然后上传到
/tmp 目录下。  www.2cto.com  
 
2、  解压缩安装
[root@localhosttmp]# tar -zxvf rlwrap-0.37.tar.gz
[root@localhosttmp]# cd rlwrap-0.37
[root@localhostrlwrap-0.37]# ls
[root@localhostrlwrap-0.37]# ./configure
[root@localhostrlwrap-0.37]#make
[root@localhostrlwrap-0.37]#make install
 
3、  验证安装结果
[root@localhost rlwrap-0.37]#su – oracle
[oracle@localhost ~]$ rlwrap
Usage: rlwrap [options] command ...
Options:
  -a[password:]              --always-readline[=password:]
  -A                         --ansi-colour-aware
[oracle@localhost ~]$ rlwrap sqlplus / as sysdba;
SQL*Plus: Release 10.1.0.3.0 -Production on ??Υ 9? 3 12:49:42 2010
Copyright (c) 1982, 2004, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g EnterpriseEdition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and DataMining options
SQL> select status fromv$instance;
STATUS  www.2cto.com  
------------
OPEN
 
4、安装报错
    rlwrap: error while loadingshared libraries: libreadline.so.5: cannot open shared object file: No suchfile or directory
 
   解决办法:
      在oracle下的.bash_profile中$PATH路径中增加/usr/local/bin路径
    PATH=/usr/local/bin:$PATH;export PATH
 
5、 编辑oracle用户下的.bash_profile
增加
alias sqlplus=’rlwrap sqlplus’
alias rman=’rlwrap rman’
---------------------------------------------------------------------------------------------
默认情况下,在LINUX下使用SQLPLUS非常麻烦,退格键和命令记录都不能使用,我们最好安装rlwrap来实现在SQLPLUS和RMAN里的退格键和命令记录的功能
 
# yum install ncurses ncurses-devel readline readline-devel
# tar -zxvf rlwrap-0.36.tar.gz
# cd rlwrap-0.36
# ./configure
# make && make install
# su – oracle
[oracle@rac3 ~]$ echo 'alias sqlplus="rlwrap sqlplus"' >> ~/.bash_profile
[oracle@rac3 ~]$ echo 'alias rman="rlwrap rman"' >> ~/.bash_profile
---------------------------------------------------------------------------------------------
 
Linux的SQL*Plus不太好用,通过安装rlwrap可以提高用户体验,这样就可以使用光标上下键来查找历史命令,使用退格键backspace了。
安装方法如下:  www.2cto.com  
 
1、安装GNU readline
yum install readline
yum install readline-devel
 
2、安装rlwrap-0.37.tar.gz
http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.37.tar.gz
然后./configure、make、make install
 
3、编辑Oracle用户.bash_profile
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
 
 
 
作者 aaron8219
解决Sqlplus在Linux下光标乱码的方法
分享到:
oracle中system修改sys密码,sys修改syst...
oracle中system修改sys密码,sys修改system密码的问题 看看下面的实例:  以sys账户连接数据库:  SQL>   conn   sys/test   as   sysdba;  Connected   to   Oracle9i   Enterprise   Edition   Release   9.2.0.1.0    Connected   as   SYS    下列查询说明现在只有sys账户拥有sysdba与sysoper的权...
Oracle对2位年份的处理简析
Oracle对2位年份的处理简析 虽然Oracle数据存储了4位的年份,但是如果只提供2位数字,Oracle就会根据使用的格式是YY还是RR来解释世纪。 YY格式 如果日期中的年份采用的格式为YY,并且只提供了2位年份,那么就认为这一年世纪与数据库服务器上当前设置的世纪相同。因此,指定年份的前两位数字与前年份的前两位数据字相同。例...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……