Understanding Oracle's glogin.sql Script and Its Usage
In Oracle, glogin.sql is a script that SQLPlus executes when it starts up.
It stands for "global login script." This script is typically used to set
environment variables, define aliases, customize SQLPlus settings, and
perform other tasks that you want to happen automatically each time you
start SQL*Plus.
Location: The glogin.sql script is usually in the SQL*Plus system-wide
initialization directory. The exact location depends on your Oracle
installation and environment settings. Common locations include
$ORACLE_HOME/sqlplus/admin or
$ORACLE_HOME/sqlplus/admin/glogin.sql.
Execution: When you start SQL*Plus, it automatically executes the
glogin.sql script if it exists in the specified directory.
Usage: You can customize the glogin.sql script to perform various tasks
such as:
- Setting default environment variables (e.g., NLS_LANG, ORACLE_HOME).
- Defining SQL*Plus settings (e.g., SQLPROMPT, LINESIZE, PAGESIZE).
- Creating aliases for commonly used commands or SQL queries.
- Displaying a welcome message or disclaimer.
- Any other initialization tasks you want to apply globally for all SQL*Plus sessions.
set lines 250
set pages 49999
col table_name for a30
col owner for a30
COLUMN instance_name NEW_VALUE xInstance NOPRINT
SELECT upper(instance_name) instance_name FROM v$instance;
SET SQLPROMPT "&_user@&&xInstance. > "
Comments
Post a Comment