|René Nyffenegger's collection of things on the web|
René Nyffenegger on Oracle - Most wanted - Feedback
Storing settings for SQL*PLUS (login.sql and glogin.sql)
Whenever SQL*PLUS starts up, it looks for a file named glogin.sql under the directory $ORACLE_HOME/sqlplus/admin. If such a file is found, it is read and the containing statements executed. This allows to store settings (such as linesize) accross SQL*PLUS sessions.
Additionally, after reading glogin.sql, sql*plus also looks for a file named login.sql in the directory from where SQL*PLUS was and in the directory that the environment variable SQLPATH points to and reads it and executes it. Settings from the login.sql take precedence over settings from glogin.sql
If the restriction level is set to 3, the login.sql is not read.
A common login.sql file
Since Oracle 10g, the login.sql is executed after a connect
This allows to have a prompt that displays the username. For that, the following line must be in the login.sql:
See also the set store command.