Tips and Techniques: The glogin.sql and login.sql Files

If you want to retain certain SQL*Plus settings, you can create a login.sql file for your individual computer in a client-server setup. You can also create a glogin.sql file for all users if you want all your users to have the identical settings or if you use iSQL*Plus.

The login.sql or glogin.sql files may contain SQL*Plus commands or SQL statements you want to execute after a successful user login into the SQL*Plus or iSQL*Plus. This entries in the login.sql or glogin.sql file work much like any SQL*Plus script.

For example, if you always want to set the FEEDBACK setting to the value of one, your login.sql or glogin.sql file would have this entry:

SET FEEDBACK 1

Another useful entries may be this:

SET SQLPROMPT _USER'@'_CONNECT_IDENTIFIER>

The entry changes the SQL> prompt to the User ID and SID of the database you are connected to. If you are logged in as the STUDENT user and your SID is called ORCL it will change the prompt to STUDENT@ORCL>. You will find additional useful PROMPT options in Chapter 13 of the book.

You find the login.sql or glogin.sql file in the sqlplus\admin subdirectory of your Oracle home directory. Note the PROMPT command only works in SQL*Plus, not iSQL*Plus.