I’ve been poking around of late for a decent login.sql script that I can use and thought I’d share what I have so far. No real surprises here, but I really do like the part that automatically sizes your line to the size of your screen.
SET FEEDBACK OFF SET TERMOUT OFF HOST echo "set linesize" $(stty -a|head -n1|cut -f7 -d' '|cut -f1 -d';') > .tmp.sql @.tmp.sql HOST rm -f .tmp.sql COLUMN X NEW_VALUE Y SELECT LOWER(USER || '@' || SYS_CONTEXT('userenv', 'instance_name')) X FROM dual; SET SQLPROMPT '&Y> ' ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS'; ALTER SESSION SET NLS_TIMESTAMP_FORMAT='DD-MON-YYYY HH24:MI:SS.FF'; SET TIMING ON SET PAGESIZE 1000 SET LONG 10000 SET TERMOUT ON SET FEEDBACK ON SET TAB OFF SET TRIM ON SET TRIMSPOOL ON set truncate on set arraysize 500 set serveroutput on size unlimited set verify off set trimout on set describe depth 1 linenum on indent on col first_change# for 99999999999999999 col next_change# for 99999999999999999 col checkpoint_change# for 99999999999999999 col resetlogs_change# for 99999999999999999 col plan_plus_exp for a100 col value_col_plus_show_param ON HEADING 'VALUE' FORMAT a100 col name_col_plus_show_param ON HEADING 'PARAMETER_NAME' FORMAT a60