SQL*PLUS

Setting up sqlplus environment

SQL*Plus searches for a glogin.sql in $ORACLE_HOME/sqlplus/admin and then login.sql script in your SQLPATH. Normally I set up a directory for sql scripts and place a login.sql file in their or I place it in my home directory. Then I add this directory to SQLPATH in .profile (I also add it to PATH for convenience.

Example login.sql
define _editor=vi
set serveroutput on size 1000000
set trimspool on
set long 500
set linesize 100
set pagesize 9999


Where:
DEFINE EDITOR=VI sets the default editor
SET SERVEROUTPUT ON SIZE 1000000 enables DBMS_OUTPUT to be on by default and sets the buffer size to be as large as possible.
SET TRIMSPOOL ON ensures that, when spooling, lines will be blank-trimmed and not fixed width (otherwise will be as wide as your linesize setting).
SET LONG 500 - default bytes displayed for LONG or CLOB columns.
SET LINESIZE 100 sets width of line displayed.
SET PAGESIZE 9999 controls when SQL*Plus displays headings.
COLUMN PLAN_PLUS_EXP FORMAT A80 sets width of EXPLAIN PLAN output, a width of A80 generally holds full plan.