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: Fixing a little problem in the login.sql script found in Tom Kyte's book

Re: Fixing a little problem in the login.sql script found in Tom Kyte's book

From: FC <flavio_at_tin.it>
Date: Wed, 15 Jan 2003 10:10:57 GMT
Message-ID: <RsaV9.32024$0v.959827@news1.tin.it>

"Niall Litchfield" <n-litchfield_at_audit-commission.gov.uk> wrote in message news:3e252572$0$227$ed9e5944_at_reading.news.pipex.net...
> "FC" <flavio_at_tin.it> wrote in message
> news:Ls_U9.40554$AA2.1857705_at_news2.tin.it...
> >
> > "Sybrand Bakker" <gooiditweg_at_sybrandb.demon.nl> wrote in message
> > news:v4k82vci2t3jb2jn7qsf5op82dqoe7gble_at_4ax.com...
> > > On Tue, 14 Jan 2003 14:19:41 GMT, "FC" <flavio_at_tin.it> wrote:
> > >
> > > >
> > > >When you start SQL*Plus with /NOLOG,
> > >
> > >
> > > you are expected to have a connect statement in your script.
> > >
> > >
> > > Sybrand Bakker, Senior Oracle DBA
> > >
> >
> > Sybrand,
> > I am not sure to understand the objection.
> > What if you are about to start the DB ?

>

> The objection is that the script as provided by Tom is designed to set the
> prompt to the connected user, You are not so much fixing it as adding
> functionality to it.

Well, it's adding error management "functionality" indeed.  I don't know if you are used to call error management with that name, certainly a program that doesn't hang has more functionality than one that does.

> Bear in mind that the script was around before the days
> of using sqlplus to start the db. Incidentally your version is very
similar
> to the one on the co-operative FAQ at www.jlcomp.demon.co.uk

>

> Apologies to all who have seen this rant from me before. Consider the
> following sqlplus session. initially the prompt is correct.
>

> niall_at_NL9IWK.US.ORACLE.COM>
> niall_at_NL9IWK.US.ORACLE.COM> conn system_at_dev -- now connect to a dev
instance
> Enter password:
> Connected.
> niall_at_NL9IWK.US.ORACLE.COM> -- prompt shows wrong global name
> niall_at_NL9IWK.US.ORACLE.COM> conn system/password_at_badname
> ERROR:
> ORA-12154: TNS:could not resolve service name
>
>

> Warning: You are no longer connected to ORACLE.
> niall_at_NL9IWK.US.ORACLE.COM> -- now the prompt shows both the wrong
username
> and wrong global name.

>

That's true but, as stated in the book, you shoud rather user a @connect script, so that the login.sql script is run every time you connect, not just when SQL*Plus is started up.
At this point you may object that you don't like using @connect and that is ok. Me too.
I am not using this login.sql script either, it's just a humble workaround to a very specific situation.

> In my view a prompt that shows incorrect information is more dangerous
than
> one that shows you none. There are work arounds (like never type connect
> and/or write a sql script to allow db connections from within sqlplus) but
> none that give me a guarantee that I won't one day be sitting at a prompt
> that says

>

> system_at_dev> drop user application_user cascade;
> user dropped.
>

> when actually what happened was
> system_at_live> drop user application_user cascade; Oops.
>

> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK

I agree, but then the problem is with the script itself, not with that little addition.
This script is clearly aimed to people who need to get aquainted with the DB, not to experts.

Bye,
Flavio Received on Wed Jan 15 2003 - 04:10:57 CST

Original text of this message

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