rlwrap 的安装使用(实现sqlplus下命令行history编辑)
2013-04-28 14:23
549 查看
rlwrap 的安装使用
在Windows操作系统上,当在DOS命令窗口中运行SQL*Plus的时候,可以使用向上,向下键来跳回之前已经执行过的SQL语句.你可以根据需要修改他们,然后按Enter键重新提交执行.
然而,当在Linux Shell中运行SQL*Plus的时候,并不提供浏览历史命令行的功能.
为了在Linux中达到同样的目的,你可以安装rlwrap,这个程式本身是个Shell,可以运行任何你提供给它的命令包括参数,并添加命令历史浏览功能.The rlwrap program is under the GPL license.
一:安装readline
OS的安装光盘里提供了readline包.
[root@oracle11g ~]# rpm -Uvh readline*
error: Failed dependencies: libtermcap-devel is needed by readline-devel-5.1-1.1.i386.rpm
[root@oracle11g ~]# rpm -Uvh libtermcap-devel-2.0.8-46.1.i386.rpm
[root@oracle11g ~]# rpm -Uvh readline*
package readline-5.1-1.1 is already installed
[root@oracle11g ~]# rpm -Uvh readline-devel-5.1-1.1.i386.rpm
二:安装rlwrap
Download:
http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@oracle11g ~]# tar -zxvf rlwrap-0.30.tar.gz
[root@oracle11g ~]# cd rlwrap-0.30
[root@oracle11g rlwrap-0.30]# ./configure
[root@oracle11g rlwrap-0.30]# make
[root@oracle11g rlwrap-0.30]# make install
[root@oracle11g rlwrap-0.30]# rlwrap
Usage: rlwrap [options] command ...
Options:
-a[password:] --always-readline[=password:]
-A --ansi-colour-aware
-b --break-chars=
-c --complete-filenames
-C --command-name=
-D --history-no-dupes=
-f --file=
-F --history-format=
-h --help
-H --history-filename=
-i --case-insensitive
-l --logfile=
-n --no-warnings
-p[ANSI colour spec] --prompt-colour[=ANSI colour spec]
-P --pre-given=
-q --quote-characters=
-m[newline substitute] --multi-line[=newline substitute]
-r --remember
-v --version
-s --histsize= (negative: readonly)
-t --set-term-name=
bug reports, suggestions, updates:
http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@oracle11g rlwrap-0.30]# vi /home/oracle/.bash_profile
添加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
三:使用rlwrap
[oracle@oracle11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Tue Jul 29 21:28:30
2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$sga;
NAME VALUE
-------------------- ----------
Fixed Size 1299116
Variable Size 155192660
Database Buffers 79691776
Redo Buffers 2347008
使用向上键调回最后执行的命令,按Enter键重新执行或修改后按Enter键执行.
SQL> select * from v$sga;
NAME VALUE
-------------------- ----------
Fixed Size 1299116
Variable Size 155192660
Database Buffers 79691776
Redo Buffers 2347008
SQL>
Note:
解决在sqlplus下输错命令后正常删除的方法
[oracle@oracle11g ~]$ vi /home/oracle/.bash_profile
添加
stty erase ^h
在Windows操作系统上,当在DOS命令窗口中运行SQL*Plus的时候,可以使用向上,向下键来跳回之前已经执行过的SQL语句.你可以根据需要修改他们,然后按Enter键重新提交执行.
然而,当在Linux Shell中运行SQL*Plus的时候,并不提供浏览历史命令行的功能.
为了在Linux中达到同样的目的,你可以安装rlwrap,这个程式本身是个Shell,可以运行任何你提供给它的命令包括参数,并添加命令历史浏览功能.The rlwrap program is under the GPL license.
一:安装readline
OS的安装光盘里提供了readline包.
[root@oracle11g ~]# rpm -Uvh readline*
error: Failed dependencies: libtermcap-devel is needed by readline-devel-5.1-1.1.i386.rpm
[root@oracle11g ~]# rpm -Uvh libtermcap-devel-2.0.8-46.1.i386.rpm
[root@oracle11g ~]# rpm -Uvh readline*
package readline-5.1-1.1 is already installed
[root@oracle11g ~]# rpm -Uvh readline-devel-5.1-1.1.i386.rpm
二:安装rlwrap
Download:
http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@oracle11g ~]# tar -zxvf rlwrap-0.30.tar.gz
[root@oracle11g ~]# cd rlwrap-0.30
[root@oracle11g rlwrap-0.30]# ./configure
[root@oracle11g rlwrap-0.30]# make
[root@oracle11g rlwrap-0.30]# make install
[root@oracle11g rlwrap-0.30]# rlwrap
Usage: rlwrap [options] command ...
Options:
-a[password:] --always-readline[=password:]
-A --ansi-colour-aware
-b --break-chars=
-c --complete-filenames
-C --command-name=
-D --history-no-dupes=
-f --file=
-F --history-format=
-h --help
-H --history-filename=
-i --case-insensitive
-l --logfile=
-n --no-warnings
-p[ANSI colour spec] --prompt-colour[=ANSI colour spec]
-P --pre-given=
-q --quote-characters=
-m[newline substitute] --multi-line[=newline substitute]
-r --remember
-v --version
-s --histsize= (negative: readonly)
-t --set-term-name=
bug reports, suggestions, updates:
http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@oracle11g rlwrap-0.30]# vi /home/oracle/.bash_profile
添加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
三:使用rlwrap
[oracle@oracle11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Tue Jul 29 21:28:30
2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$sga;
NAME VALUE
-------------------- ----------
Fixed Size 1299116
Variable Size 155192660
Database Buffers 79691776
Redo Buffers 2347008
使用向上键调回最后执行的命令,按Enter键重新执行或修改后按Enter键执行.
SQL> select * from v$sga;
NAME VALUE
-------------------- ----------
Fixed Size 1299116
Variable Size 155192660
Database Buffers 79691776
Redo Buffers 2347008
SQL>
Note:
解决在sqlplus下输错命令后正常删除的方法
[oracle@oracle11g ~]$ vi /home/oracle/.bash_profile
添加
stty erase ^h
相关文章推荐
- 安装rlwrap, 使用rlwrap调用sqlplus中历史命令
- rlwrap实现linux sqlplus 命令上下
- 让sqlplus使用更方便的rlwrap工具安装
- 【Linux】Solaris10下安装后Oracle11g的环境变量配置,实现oracle用户下支持sqlplus,lsnrctl等命令
- 安装rlwrap解决oracle sqlplus命令行下找回历史命令,以及回退键,方向键不好使的问题
- Linux 下如何 sql*plus 实现上下键历史记录显示(安装rlwrap 以及 readline)
- Linux下SQLPLUS替代工具rlwrap安装使用
- linux下使用rlwrap调用sqlplus中历史命令
- 使用rlwrap调用sqlplus中历史命令
- 使用rlwrap实现SQLplus翻页功能
- oracle sqlplus+rlwrap-实现查看历史命令的操作
- 使用rlwrap上下翻sqlplus历史命令
- 有关SQL*PLUS命令使用大全
- SQL*plus中,使用上下键,调出历史命令
- SQL*PLUS命令的使用大全(已更新)
- Oracle的学习一:安装与卸载、sql *plus常用命令、Oracle用户管理
- zt: SQL*PLUS常用命令和Decode()函数使用技巧
- [好玩的想法]使用ArcGIS Engine+WebService,在客户机上不安装Engine Runtime实现编辑SDE图层
- 【转载】使用rlwrap增强Linux中的sqlplus命令行功能
- Linux中yum手动安装、手动建立仓库文件夹关联实现关联包自动安装、yum相关命令使用