본문 바로가기

IT/oracle

rlwrap - SQLPlus 편리하게 사용하기

rlwrap을 사용하여 SQLPLUS 편리하게 사용하기


Installation From EPEL

Configure the EPEL yum repository, as described here. In this case i was installing on Oracle Linux 6 (x86-64), so I downloaded the package displayed here. Don't worry that it is listed as a, i386 package. It just installs the yum repository. The following commands download and configure the EPEL repository.

# wget http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm

With the repository in place you can install rlwrap using the following command.

# yum install rlwrap

Manual Installation

Download the latest rlwrap software from the following URL.

Unzip and install the software using the following commands.

gunzip rlwrap*.gz
tar -xvf rlwrap*.tar
cd rlwrap*
./configure
make
make check
make install

Post-Installation

Run the following commands, or better still append then to the ".bash_profile" of the oracle software owner.

alias rlsqlplus='rlwrap sqlplus'
alias rlrman='rlwrap rman'

You can now start SQL*Plus or RMAN using "rlsqlplus" and "rlrman" respectively, and you will have a basic command history and the current line will be editable using the arrow and delete keys.

Thanks to Laurent Schneider for pointing out the potential dangers of using alias names of "sqlplus" and "rman", which include:

  • rlwrap may affect the behaviour of CTRL+C during interactive sessions. I've done a few tests on this and I can't see a difference in behavior of CTRL+C with or without rlwrap. Perhaps this was a problem with earlier versions.
  • rlwrap only supports interactive sessions, so scripts like the following may not work as expected.

    sqlplus <<EOF ... select ... EOF

    From what I can see the alias doesn't seem to work from within a shell script (bash, ksh or csh), so it doesn't really present a danger. Thanks Maxim for putting me on to this.

  • rlwrap is not an Oracle tool! I guess it's best to leave the sqlplus and rman commands clean and alias using a different name, just in case.

For more information see:

Hope this helps. Regards Tim...

'IT > oracle' 카테고리의 다른 글

Redo Log File 관리 하기  (0) 2015.01.29
Redo Log의 생성 원리  (0) 2015.01.28
Glossary  (0) 2015.01.28
Control File 다중화(Multiplexing)하기  (0) 2015.01.28
profile 설정  (0) 2015.01.28
Oracle 기동 순서 및 기동/종료 방법  (0) 2015.01.28
Parameter File 및 pfile 생성  (0) 2015.01.28
Alert Log 파일 위치  (0) 2015.01.28
scott 계정 활성화  (0) 2015.01.27
주요 SQL  (0) 2015.01.27