Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: set sqlprompt to something useful

Re: set sqlprompt to something useful

From: Brian Peasland <peasland_at_edcmail.cr.usgs.gov>
Date: Fri, 10 Dec 1999 13:59:47 GMT
Message-ID: <38510753.E34DF350@edcmail.cr.usgs.gov>


You are right. login.sql (or glogin.sql) runs when you start your SQL*Plus session. After the session is started, if you issue a subsequent connect, the login.sql does not get re-executed. So if your login.sql changes your prompt to indicate which host,sid,globalname, etc., you are connected to and you issue a subsequent connect, the prompt may be wrong.

To fix this, you may want to create a script which takes userid/password_at_dbname as a parameter. This script (call it myconnect.sql) can connect to the database and then issue run the login.sql for you. All you'll have to do is SQL> @myconnect me/pswd_at_db

HTH,
Brian

Larry DiGiovanni wrote:
>
> Is it just me, or does login.sql not run when I CONNECT to another
> instance within a SQL*Plus session? If this is the case, then isn't
> the prompt set by the below at risk of indicating the wrong instance?
>
> > I put something like this:
> >
> > column global_name new_value gname
> > set termout off
> > select lower(user) || '@' ||
> > decode(global_name, 'ORACLE8.WORLD', '8.0', 'ORA8I.WORLD',
> > '8i', global_name ) global_name from global_name;
> > set termout on
> > set sqlprompt '&gname> '
> >
> > into my login.sql. you cannot really get at the SID (environment
> variable --
> > you could problem do something with HOST) so I use the global
> database name.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Fri Dec 10 1999 - 07:59:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US