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 fileworks 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  

Other useful entries may be:

SET TIME ON  SET SQLPROMPT '&_connect_identifier>'  

The first entry displays the current time in front of the SQL> prompt such as 20:19:07 SQL>. The second entry allows you to also change the SQL> prompt to the SID of the database you are connected to. If your SID is called ORCL it will change the prompt to ORCL>. Note the PROMPT command only works in SQL*Plus, not iSQL*Plus.

You find the login.sql or glogin.sql file in the sqlplus\admin subdirectory of your Oracle home directory.

Read More Tips and Techniques