Knowledge Base : UNIX sqlplus configuration

Configure SQLPlus properly in a UNIX environment

Basic UNIX configuration

Backspace, Delete and Cursor keys should work beforehand.

Useful environment settings include (using bash):

ORACLE_BASE=/app/oracle/1120/db (or similar)
ORACLE_HOME=/app/oracle/1120/db/product/11.2.0.3
ORACLE_SID=XXX
ORATAB=/var/opt/oracle/oratab

PATH=$ORACLE_HOME/bin:$PATH

TERM=vt100
PS1='u@h w$ '
PS2='> '
PS4='+ '

NLS_LANG=AMERICAN_AMERICA.UTF8

SQLPlus configuration

SQLPlus can be configured by a “login.sql” file, located in the current directory when calling sqlplus.
Useful settings include:

set pagesize 0
set linesize 50
set sqlprompt "&_user@&_CONNECT_IDENTIFIER> "
define _editor=vi

With these settings, “ed” and “r” command should work.

RLWrap extensions

Command completion can be achieved by installing RLWRRAP and the sqlplus rlwrap extensions.
These can be found at Linuxification.AT

Rlwrap is a GNU readline library wrapper and can be found here

Readline-6.1 packages for Solaris are available from OpenCSW.