Home > Database > Mysql Tutorial > body text

Linux 下如何 sql*plus 实现上下键历史记录显示(安装rlwrap 以及 readline)

WBOY
Release: 2016-06-07 17:34:48
Original
1207 people have browsed it

Windows 下的 sql*plus 使自带上下键历史记录显示的,比较方便,但是linux默认却没有这个功能,需要拓展一下才可以使用,这里就引

Windows 下的 sql*plus 使自带上下键历史记录显示的,比较方便,,但是linux默认却没有这个功能,需要拓展一下才可以使用,这里就引进了需要安装的两个软件包,rlwrap以及readline。安装后,Linux下的sql*plus就可以实现上下键历史记录显示的功能了。看到网络上很多朋友都有这样的疑问,这里简单记录一下安装过程,最下面是两个包的下载地址。包括:rlwrap-0.37.tar.gz()以及readline-6.2.tar.gz。

readline-6.2.tar.gz 软件包下载:

免费下载地址在

用户名与密码都是

具体下载目录在 /2014年资料/1月/21日/Linux 下如何 sql&plus 实现上下键历史记录显示(安装rlwrap 以及 readline)

下载方法见

------------------------------------分割线------------------------------------

安装过程很简单,先readline再rlwrap

root用户:

tar -xzvf readline-6.2.tar.gz

cd readline-6.2

./configure

make

make install

rlwrap 过程相同

tar -xzvf rlwrap-0.37.tar.gz

cd rlwrap-0.37

./configure

make

make install

安装成功后再root用户下rlwrap 会有下面的结果

[root@rh56 ~]# 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=
  -g                --forget-matching=
  -h                        --help
  -H                  --history-filename=
  -i                        --case-insensitive
  -I                        --pass-sigint-as-sigterm
  -l                  --logfile=
  -n                        --no-warnings
  -N                        --no-children
  -o                        --one-shot
  -O                --only-cook=
  -p[colour]                --prompt-colour[=colour]
  -P                  --pre-given=
  -q                  --quote-characters=
  -m[newline substitute]    --multi-line[=newline substitute]
  -r                        --remember
  -R                        --renice
  -v                        --version
  -s                      --histsize= (negative: readonly)
  -S                --substitute-prompt=
  -t                  --set-term-name=
  -w                      --wait-before-prompt= (msec,   -z        --filter=

bug reports, suggestions, updates:
~hlub/uck/rlwrap/

然后切换到Oracle用户下,修改一下环境变量。

其实不只是sql*plus可以受益,其他需要执行命令行的工具都可以受益。

alias s='rlwrap sqlplus / as sysdba'
alias adrci='rlwrap adrci'
alias ggsci='rlwrap /u01/gg/ggsci'
alias bbed='rlwrap $ORACLE_HOME/rdbms/lib/bbed parfile=/home/oracle/bbed/dex.par'
alias rman='rlwrap rman target /'

这样就结束了,自己试试吧。

相关阅读:

rlwrap - 解决Linux下SQLPLUS退格、上翻键乱码问题

SQLPLUS spool 到动态日志文件名

Oracle SQLPLUS提示符设置

通过设置SQLPLUS ARRAYSIZE(行预取)加快SQL返回速度

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!