Two script files are executed every
time SQL*Plus is started. These scripts define the site profile and
the user profile, and are named, respectively,
glogin.sql
and login.sql
.
The site profile is made up of the commands contained in
glogin.sql
, which is the
global
login file, and is
automatically executed every time a user runs SQL*Plus on a given
computer system. The location of glogin.sql
varies from one operating system to the next, but it is always below
the directory containing the SQL*Plus product. On a default Windows
95 installation of Oracle8, glogin.sql
may be
found in the following directory:
C:ORAWIN95PLUS80
On a typical Unix system, such as the HP-9000, the
glogin.sql
file will be found in this directory:
$ORACLE_HOME/sqlplus/admin
The specific version of SQL*Plus you are running makes a difference
as well. If you have multiple versions of SQL*Plus installed, the
default installation procedures will result in your having a separate
glogin.sql
file for each. For example, a Windows
95 PC running both SQL*Plus 8.0 and SQL*Plus 3.3 will have a
glogin.sql
file in each of the following two
directories:
C:ORAWIN95PLUS80 C:ORAWIN95PLUS33
The specific file that is executed will depend on which version of SQL*Plus you are running.
On Windows 95/NT, the PLUSXX registry setting, where XX refers to the
specific SQL*Plus version, points to the location of
glogin.sql
. By pointing the PLUS80 and PLUS33
registry settings to the same directory, it is possible to end up
with one global login file that is consistent across all versions of
SQL*Plus.
The default glogin.sql
file, supplied by Oracle
for version 8.0 of SQL*Plus, looks like this:
-- -- $Header: /plus/v4/spam/precious/files/ACTIVE/glogin.sql, -- v 1.1 1995/12/19 02:55:18 cjones Exp $ -- Copyright (c) Oracle Corporation 1988, 1994, 1995. All Rights Reserved. -- -- SQL*Plus Global Login startup file. -- -- This is the global login file for SQL*Plus. -- Add any sqlplus commands here that are to be -- executed when a user invokes sqlplus -- Used by Trusted Oracle column ROWLABEL format A15 -- Used for the SHOW ERRORS command column LINE/COL format A8 column ERROR format A65 WORD_WRAPPED -- For backward compatibility set pagesize 14 -- Defaults for SET AUTOTRACE EXPLAIN report column id_plus_exp format 990 heading i column parent_id_plus_exp format 990 heading p column plan_plus_exp format a60 column object_node_plus_exp format a8 column other_tag_plus_exp format a29 column other_plus_exp format a44
Most of the commands in the default glogin.sql
file are COLUMN commands that format the output from the SQL*Plus
autotrace facility and from the SHOW ERRORS command. It is
interesting to note that the pagesize has been set to 14 for
compatibility purposes. In Oracle 7.1 and earlier, the default
pagesize was 14. In newer versions of Oracle, the pagesize is 24. In
order to prevent problems with scripts that were written with the old
default in mind, this glogin.sql
file sets the
pagesize to the old value.
The user profile is similar to the site
profile, except that it is intended to be user-specific. The command
file name is login.sql
, and it is executed
immediately after the glogin.sql
file. SQL*Plus
searches for the login.sql
file in the current
directory first; then it searches the directories listed in the
SQLPATH environment variable. In a Unix installation, there will not
be a default login.sql
file, nor will there be a
default SQLPATH variable. Under the various Windows environments, you
will most likely have a default login.sql
file
in one of the following directories:
C:ORAWIN95DBS --Windows 95 C:ORANTDBS --Windows NT C:ORAWINDBS --Windows 3.1, 3.11
You can add to the login.sql
file, putting in
whatever commands make your life easier. If you are running under
Unix, you should make certain that your SQLPATH environment variable
points to the directory containing your
login.sql
; otherwise, SQL*Plus won’t be
able to find it when you are working in another directory.