Search notes:

SQLPATH - login.sql

This SQL script is the user profile script.

login.sql not automatically executed

Before Oracle 12R2, this script was automatically executed when SQL*Plus was started if the $SQLPATH environment variable pointed to the directory in which the script was located.
When this mechanism was still working, the script was executed after also executing the site profile ($ORACLE_HOME/sqlplus/admin/glogin.sql)
In Linux/Unix environment, the file is executed if the environment variable ORACLE_PATH points to the directory where login.sql is located.
See also MOS note 2274608.1: Sqlplus 12.2.0.1 no Longer Running [g]login.sql on Windows OS.

login.sql

The following login.sql script sets a few SQL*Plus settings to make working easier (imho) and alters the prompt of SQL*Plus to show the connected user name and service name or database name (depending on what is commented out).
set serveroutput on size 999999 format wrapped
set feedback         off
set verify           off
set lines            200
set pages           5000
set long          100000
set longchunksize 100000
set tab              off
set sqlblanklines     on
set exitcommit       off

define _editor=gvim
-- define _editor=notepad

alter session set nls_date_format      = 'yyyy-mm-dd hh24:mi:ss';
alter session set nls_language         = 'english';
alter session set nls_length_semantics =  char;
alter session set plsql_warnings       = 'enable:all';

--  SQL Prompt {
set termout off
define sqlprompt=none
column sqlprompt new_value sqlprompt

select
   lower(sys_context('USERENV','CURRENT_USER')) || '@' ||
-- sys_context('USERENV','DB_NAME'     )
   sys_context('USERENV','SERVICE_NAME')
as
   sqlprompt
from
   dual;

set sqlprompt '&sqlprompt> '
undefine sqlprompt
set termout on
-- }

set editfile %temp%\sqlplus.sql
Github repository Oracle-SQLPATH, path: /login.sql

See also

The SQL Developer value of Filename for connection startup script, found under its menu Tools -> Preferences -> Database.
Oracle: files for ORACLE_PATH / SQLPATH

Links

Franck Pachot's blog: Oracle 12cR2: changes for login.sql.

Index