Where to put login.sql in Windows environment to configure SQL Plus

oraclesqlplus

I installed Oracle 10g XE on my Windows Server 2008 R2. Now I would like to configure SQL Plus to use login.sql for login settings. I created a login.sql file and put it into a

C:\users\myname

folder, but it does not seem to work. Where should I put this configuration file in Windows environment? My login.sql file is as follows:

SET pagesize 2000
SET LONG 10000
SET linesize 1000
COLUMN last_name format a20
COLUMN total format 999,999,999
SET feedback ON
alter session set nls_date_format = 'yyyy-mm-dd hh:mi:ssPM'
COLUMN global_name new_value gname
SET TERMOUT OFF
SELECT LOWER(USER) || '@' || global_name||CHR(10)||'SQL> ' AS global_name
FROM   global_name;
SET SQLPROMPT '&gname'
SET TERMOUT ON;

Best Answer

You need to set the environment variable SQLPATH (through the Control Panel) to tell SQL*Plus where to find the file:

SQLPATH=C:\users\myname

Setting environment variables is explained here: http://support.microsoft.com/kb/310519/en-us