Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: login.sql script
About that login.sql file . . .
Okay, I answered my own question. And yes, I should have known better. Unfortunately, in my old job I used only the centralized glogin.sql exclusively rather than my own login.sql, so I didn't have all the info on this.
> For a reason that I am unable to determine, SQL*Plus sometimes executes
the
> script and it sometimes does not.
I figured out that it would execute only if I were in my home directory (where the script is located). For some reason, I had gotten it into my head many moons ago that SQL*Plus on Unix looks in your home directory (only) for the login.sql script (not in SQLPATH like for other SQL scripts). Duh. So I checked the SQL*Plus User's Guide, and I'll be darned, there on Page 3-15 . . .
"when you start SQL*Plus, it automatically searches for your LOGIN file (first in your local directory and then on a system-dependent path) and runs the commands it finds there. "
I modified my SQLPATH variable to include my home directory and all was well. I guess I'll move the script to another location (I hate stuff in my home directory!) now that I realize that SQLPATH searches for login.sql as well.
For those who weren't aware of it, SQLPATH is an environment variable that determines where SQL*Plus looks for scripts if not in the current directory. Mine is set via ...
SQLPATH=.:$DBA/scripts:$HOME
All that was startlingly obvious in retrospect!
Chris