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

Home -> Community -> Usenet -> c.d.o.server -> Re: Shell Script Heros

Re: Shell Script Heros

From: Tom Churchward <tcprof_at_tolan.fr>
Date: Tue, 07 Nov 2006 14:30:54 +0100
Message-ID: <4421l2hk2s8n5gnhnbublth35kso800ukm@4ax.com>


On 6 Nov 2006 21:48:21 -0800, "oracledba.amit_at_gmail.com" <oracledba.amit_at_gmail.com> wrote:

>Dear Sirs,
>
>I am new to shell scripting and I have to create a shell script that
>will ask the user to enter DB Sid, User Name and Password. The script
>will then validate this information.
>
>If the user input is not valid, then he should be shown a message that
>user input was not right. And if the user-input is right, then I have
>to run few scripts, after showing him a messege that his input was
>right.
>
>Any clues on how to do that would be a good help.
>
>Thanking you in anticipation.
>
>Regards,
>Amit

Hi Amit

While I don't consider myself a shell script hero, here's how I did it for a client recently in korn shell on Solaris 8, youll need to set up values for $TMPDIR and $TMPFILE beforehand. The script will keep prompting you until it is able to connect to Oracle as system user. Just be aware that if it isn't able to connect for some other reason that password incorrect it may not be immediately obvious - but it's fairly easy to code for this.

Hope this helps
Tom Churchward

http://tcprof.tolan.fr - The home of tcprof, an Oracle 10046 Trace File Profiler.

#
#--------------------------------------------------------
#  system password
#--------------------------------------------------------
#

rm -f ${TMPDIR}/${TMPFILE}
#
while [ ! -f ${TMPDIR}/${TMPFILE} ]
do
echo " "
read SYSTEMPSWD?"Input system password: " #
sqlplus -s system/${SYSTEMPSWD} <<EOF > /dev/null 2>&1 set termout off
spool ${TMPDIR}/${TMPFILE}
select 1 from dual;
exit;
EOF
done
#
rm -f ${TMPDIR}/${TMPFILE} Received on Tue Nov 07 2006 - 07:30:54 CST

Original text of this message

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