1.安装rlwrap的初衷;
2.安装rlwrap工具和遇到的问题;
3.使用rlwrap 工具;
1.安装rlwrap的初衷:
在Windows 下使用SQLPLUS都是可以使用上下左右方向键前后左右翻转移动,每句命令也是可以往前或往后修改,但Linux 下却不行,一直要使用SQLPLUS,这样做有些难受,网上查询了下,可以使用rlwrap 解决这个问题,安装中遇到些问题记录如下,方便以后查阅;
2.安装rlwrap工具和遇到的问题:
2.1到rlwrap官网(http://utopia.knoware.nl/~hlub/uck/rlwrap)下载rlwrap工具,目前版本是0.4.1;
2.2 解压rlwrap工具包:
[[email protected] ~]#tar -zxvf rlwrap-0.41.tar.gz
[[email protected] ~]#cd rlwrap-0.41
[[email protected] rlwrap-0.41]# ./configure
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }如果最后提示 You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build this program!
则还需要安装:readline
[[email protected] rlwrap-0.41]# yum -y install readline*
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }关联包:
ncurses-devel-5.7-3.20090208.el6.x86_64
readline-devel-6.0-4.el6.x86_64
readline-static-6.0-4.el6.x86_64
readline-static-6.0-4.el6.x86_64
readline-devel-6.0-4.el6.x86_64
ncurses-devel-5.7-3.20090208.el6.x86_64
那如果这些包安装失败,可以到官网上找这些包下载独立安装,安装无误后,在一次尝试:
[[email protected] rlwrap-0.41]# ./configure
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }没有任何错误后 make
[[email protected] rlwrap-0.41]# make
[[email protected] rlwrap-0.41]# make install
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }至此rlwrap工具安装成功,键入rlwrap 后能看到相应提示;
3.使用rlwrap 工具:
输入 rlwrap 后跟 sqlplus,sqlplus后面的参数和平常的一样,不一样的地方就是多了前缀,多了个伴;
[[email protected] rlwrap-0.41]$ rlwrap sqlplus /
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 13 22:32:30 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[email protected]>
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
从此方向键的约束彻底解放,不用再担心输错和找不到前几句命令了,好好研究吧!!!
Linux 上安装 rlwrap