SQL*Plus Configuration
You may wish to set up your SQL*Plus environment in a particular way (such as showing the current time as part of the SQL*Plus command prompt) and then reuse those settings with each session. You can do this through two host operating system files, the Site Profile for site wide settings, and the User Profile for user specific settings. The exact names of these files is system dependent; see the Oracle installation and user's guide provided for your operating system for the precise name.
[@more@]SQL*Plus Configuration
You may wish to set up your SQL*Plus environment in a particular way (such as showing the current time as part of the SQL*Plus command prompt) and then reuse those settings with each session. You can do this through two host operating system files, the Site Profile for site wide settings, and the User Profile for user specific settings. The exact names of these files is system dependent; see the Oracle installation and user's guide provided for your operating system for the precise name.
Site Profile
SQL*Plus supports a global Site Profile, a SQL*Plus script created by the database administrator. This file is generally named glogin.sql. SQL*Plus executes this script whenever any user starts SQL*Plus and SQL*Plus establishes the Oracle connection. The global Site Profile allows the DBA to set up SQL*Plus environment defaults for all users at a particular site; users cannot directly access the Site Profile.
The site profile file is $ORACLE_HOME/sqlplus/admin/glogin.sql
. If a site profile already exists at this location, it is overwritten when you install SQL*Plus. If SQL*Plus is removed, the site profile file is deleted.
User Profile
SQL*Plus also supports a User Profile, executed after the Site Profile. This file is generally named login.sql. SQL*Plus searches for the user profile in your current directory, and then the directories you specify with the SQLPATH environment variable. SQL*Plus searches this colon-separated list of directories in the order they are listed.
You can add any SQL commands, PL/SQL blocks, or SQL*Plus commands to your user profile. When you start SQL*Plus, it automatically searches for your user profile and runs the commands it contains.
A user profile is ineffective in the iSQL*Plus user interface context, and cannot be used to control the initial settings or behavior of an individual iSQL*Plus session.
Modifying Your LOGIN File
You can modify your LOGIN file just as you would any other script. You may wish to add some of the following commands to the LOGIN file:
See the SET command for more information on these and other SET command variables you may wish to set in your SQL*Plus LOGIN file.
Storing and Restoring SQL*Plus System Variables
You can store the current SQL*Plus system ("SET") variables in a host operating system file (a script) with the STORE command. If you alter any variables, this script can be run to restore the original values. This is useful if you want to reset system variables after running a report that alters them.
To store the current setting of all system variables, enter
STORE SET file_name
By default, SQL*Plus adds the extension "SQL" to the file name. If you want to use a different file extension, type a period at the end of the file name, followed by the extension. Alternatively, you can use the SET SUFFIX command to change the default file extension.
Restoring the System Variables
To restore the stored system variables, enter
START file_name
If the file has the default extension (as specified by the SET SUFFIX command), you do not need to add the period and extension to the file name.
You can also use the @ ("at" sign) or the @@ (double "at" sign) commands to run the script.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7988176/viewspace-963335/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7988176/viewspace-963335/