Monday 26 February 2007

Automatic configuration of SQL Plus on start-up

This is something I picked up from Oracle PL/SQL Programming by Steven Fewerstein and Bill Prybil.

When you start sqlplus the program reads configuration data from two files:
  • $ORACLE_HOME/sqlplus/admin/glogin.sql
  • ./login.sql
Since starting sqlplus from a directory that always contains an appropriate login.sql file isn't always possible, Bill recommends editing the glogin.sql. This is what the last lines my glogin sql look like :
-- Additional Settings by Bill Prybil
SET LINESIZE 132
SET PAGESIZE 999

-- Change the editor to vi if you don't do that sqlplus will use the editor from the $EDITOR
-- environment variable 
DEFINE _EDITOR = /usr/bin/vim

-- Format columns commonly retrieved from data dictionary
COLUMN segment_name FORMAT A30 WORD_WRAPP
COLUMN object_name FORMAT A30 WORD_WRAPP

-- set the sql prompt
SET SQLPROMPT "_USER'@'_CONNECT_IDENTIFIER >"

1 comment :

Amitabh Sharma said...

Thanks alot, helped me use notepad++ instead of regular notepad editor on windows.