Can I customize my client session when I use sqlplus ?

Of course, you can do that using glogin.sql and login.sql.
What’s the differences between glogin.sql and login.sql?
glogin.sql is used for any user, and login.sql is used for you only.
In fact, login.sql is called after glogin.sql where you start a sqlplus session.
glogin.sql is usually located in $ORACLE_HOME/sqlplus/admin, login.sql can be located where you launch sqlplus (or in the $SQLPATH, if you want to launch sqlplus from several path)
So, the examples below can be applied to login.sql and glogin.sql without differences.
This is a simple but useful example.
 
login.sql:
set lin 160
set pages 50000
define_editor=vi
Alter session set NLS_DATE_FORMAT=’YYYY-MM-DD HH24:MI:SS’;
 
— just a reminder
prompt SET LIN 160, PAGES 50000, editor = vi
prompt DATE_FORMAT example:
— date control
select sysdate as formato_data from dual;
 
set sqlprompt “&&_USER@&&_CONNECT_IDENTIFIER>”
Let’s comment each command:
 
set lin 160
set pages 5000
 
just define line and page sizes
 
define_editor=vi
 
you can choose which editor use where you invoke “ed” command in sqlplus
 
(nota: inizio textarea)
Alter session set NLS_DATE_FORMAT=’YYYY-MM-DD HH24:MI:SS’;
 
it’s only my preference to use this date format
 
— just a reminder
prompt SET LIN 160, PAGES 50000, editor = vi
prompt DATE_FORMAT example:
— date control
select sysdate as formato_data from dual;
 
these are advertises for user (for me) when sqlplus session start.
 
set sqlprompt “&&_USER@&&_CONNECT_IDENTIFIER>”
 
I work with a lot of databases, so I need to know which schema I’m using for not do damage.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *