**********************************
cd $ORACLE_HOME/sqlplus/admin
vi glogin.sql
define _editor=vi
Set serveroutput to size 1000000.
Open trimspool
Set the length to 5000
Set the line size 1000
Set page size 9999
Column plan_plus_exp format a80
Column Global Name New Value Name
Set termout off
Define gname=idle
Column Global Name New Value Name
select lower(user)| | ' @ ' | | substr(global _ name, 1,decode( dot,0,length(global_name),dot- 1) ) global_name
From (select global name, instr (global name,'.') dot from global _ name);
set sqlprompt ' & ampgname & gt'
Set termout to on.
Here are some descriptions of these scripts:
Define _editor=vi: Sets the default editor used by sql*plus. You can set the default editor as your favorite text editor (not a word processor), such as Notepad or emacs.
Set serveroutput to size 100000: this will open dbms_output by default (so you don't have to type this command every time). In addition, set the default buffer size as large as possible.
Set Trimspoonon: When the text is output offline, the spaces at both ends of the text line will be removed and the line width will be variable. If set to OFF (the default setting), the width of the text line output by spooling is equal to the set LINESIZE.
Set LONG 5000: sets the default number of bytes displayed when selecting a LONG or CLOB column.
Linesize 1000: Set the text width displayed by sql*plus to 1000 characters.
Set pagesize 9999:pagesize can control how often sql*plus prints titles. Here, pagesize is set to a very large number (so there is only one set of titles per page).
Column plan_plus_exp format a80: Sets the default width of the output of the interpretation plan obtained by autotrace. The A80 is usually enough to put down the whole plan.
Set termout on/off: It controls the return executed in @ mode.
Define gname=idle: define a variable gname with the value of idle.
Column global _ namenew _ valuegname: tells sql*plus to get the last value in the global _ name column and assign it to the replacement variable gname.
select lower(user)| | ' @ ' | | substr(global _ name, 1,decode( dot,0,length(global_name),dot- 1) ) global_name
From (select global name, instr (global name,'.') dot from global _ name); Gets the value of the global name.
Set sqlprompt' & ampgname & gt': common methods for setting SQL prompt.