Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Hi
On Mon, 23 Dec 2002, howardjr2000_at_yahoo.com.au wrote:
> I think you've missed his point. He wants to run a shell script which
> runs multiple SQL scripts, and have each SQL script run
> asynchronously. As SQL1.sql runs, so the shell script starts running
> SQL2.sql, without waiting for the first one to finish and return.
>
> Can you script something asynchronously?
>
> God knows. But that's what he's after, I think.
This can be done, but it would take a reasonable amount of testing to make sure it worked correctly.
But, first, he should probably get the cygwin distro at http://cygwin.com.
Then, he should make sure he can, Start --> Run --> bash and then type ls and get a directory listing. This will then mean that he has access to sh.exe.
His script suite would look something like:
Call this file sql1.sh:
#!/bin/sh
sqlplus user/pass << EOF > sql1.log
`cat sql1.sql`
EOF
echo "DONE WITH SQL1" > sql1_ind.log
Call this file sql2.sh:
#!/bin/sh
while (1 eq 1) do
sqlplus user/pass << EOF >> sql1.log
`cat sql2.sql`
EOF
done
Call this file doit.sh:
#!/bin/sh
done_ind=0
sql1.sh&
while (done_ind = 0) do
if exists sql1_ind.log
done_ind = 1
fi
sleep #secs
done
So, then he could kill the background process when doit.sh completes, but within the script he could get the process id and kill -9 it, or something like that anyways. If that were done, then his script would be fairly self contained.
-- Galen deForest Boyer Sweet dreams and flying machines in pieces on the ground.Received on Mon Dec 23 2002 - 22:34:09 CST