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: Beginner's ?

Re: Beginner's ?

From: Gary O'Keefe <gary_at_onegoodidea.com>
Date: Thu, 22 Jul 1999 10:06:47 GMT
Message-ID: <3796e803.4152362@news.hydro.co.uk>


On Wed, 21 Jul 1999 20:08:02 -0400, Jack Zhu <jackzhu_at_monmouth.com> wrote:

>Thank! But it doesn't work. The process is halt when execute:
>members=$(sqlplus -s <uname>/<pass> @$tempfile)
>
>Any idea?

OK. Tech support head on:

  1. You haven't just tried to execute this script literally, without subtituting your username and password for <uname> and <pass> respectively?
  2. Does the instance need to be named? In which case the line should be amended to read

  members=$(sqlplus -s <uname>/<pass>@<instance> @$tempfile)

Check out the file tnsnames.ora on your server to find out what the instance name is. The default instance name (i.e. the instance you would connect to if you simply typed 'sqlplus' is held by the ORACLE_SID environment variable. You can find out the value with 'env | grep ORACLE_SID'. If this is not set then the command will return no results, you will not connect to an instance automatically on typing 'sqlplus', and you must specify the correct instance when starting sqlplus. A quick chat with the tech support guys and DBAs at your end would be a good idea.

3. If the script hangs press ^D (ctrl+D) once. This will send the ASCII EOT (end-of-transmission) character to sqlplus, telling it to quit. Once sqlplus is finished the rest of the script will continue to completion.

>Gary O'Keefe wrote:
>>
>> #!/usr/bin/bash # or whatever is appropriate for your setup
>>
>> tempfile="tempfile.sql"
>> echo set heading off > $tempfile
>> echo set feedback off >> $tempfile
>> echo select member from v\$logfile";" >> $tempfile
>> echo exit >> $tempfile
>>
>> members=$(sqlplus -s <uname>/<pass> @$tempfile)
>> for member in $members
>> do
>> # do stuff
>> echo $member
>> done
>> rm $tempfile
>>

This script has been tested on my environment and it works to spec. If you need more help then just ask.

Gary
--
Gary O'Keefe
gary_at_onegoodidea.com

You know the score - my current employer has nothing to do with what I post Received on Thu Jul 22 1999 - 05:06:47 CDT

Original text of this message

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