I have followed Tom's Expert One on One Oracle to configure my sqlplus, I composed a file called login.sql which contains:
set serveroutput on size 1000000
set trimspool on
set long 5000
set linesize 100
set pagesize 9999
column plan_plus_exp format a80
column global_name new_value gname
set termout off
select lower(user) || '@' ||
decode(global_name, 'ORACLE10.WORLD', '10.0', 'ORA10g.WORLD',
'10g', global_name ) global_name from global_name;
set sqlprompt '&gname> '
set termout on
and then I start sqlplus, it worked well yesterday, but today the login.sql seems never been executed, because when I input the command ‘show serveroutput', it always tells me ’serveroutput off'
my database is Oracle 10g and my OS is Windows XP SP2
And if I append the script into the file glogin.sql, then things seem to work properly. Why sqlplus do not execute login.sql? In the Oracle document it says:
Previously, the SQL*Plus site and user profile files, glogin and login, were run when SQL*Plus was started with a username and password, or with /NOLOG. The profile files, glogin and login are now also run after successful CONNECT commands.
I have solved the problem. It's just because that when sqlplus start, it only check the current directory to see if there is a login.sql, so if I first switch the directory into the one where login.sql reside, it will then work properly!