About login.sql in SQL* Plus

 ** Email to info@shreyantech.com to get the Tip of the Day in your mailbox.


About login.sql

  • Executed automatically after each login to database with sqlplus or connect command. It is also executed if /nolog is specified for sqlplus.
  • Used for setting up your SQL*Plus environment automatically for every session.
  • located in directory specified by ORACLE_PATH OS environment variable in UNIX and SQLPATH OS environment variable in WINDOWS
Here is a sample login.sql to set few configuration automaticallt at login:

-- login.sql
-- SQL*Plus user login startup file.
--
-- This script is automatically run after glogin.sql
-- To change the SQL*Plus prompt to display the current user,
-- connection identifier and current time.

-- First set the database date format to show the time.
ALTER SESSION SET nls_date_format = 'HH:MI:SS';

-- SET the SQLPROMPT to include the _USER, _CONNECT_IDENTIFIER
-- and _DATE variables.
SET SQLPROMPT "_USER'@'_CONNECT_IDENTIFIER _DATE> "

-- To set the number of lines to display in a report page to 24.
SET PAGESIZE 24
-- To set the number of characters to display on each report line to 78.
SET LINESIZE 78
-- To set the number format used in a report to $99,999.
SET NUMFORMAT $99,999

#####################################################################

No comments:

Post a Comment