#!/bin/bash
# run the db2profile
. /home/db2i21/sqllib/db2profile
db2 -tvf extract_data_1.sql &
db2 -tvf extract_data_2.sql &
db2 -tvf extract_data_3.sql &
exit
DB2 is throwing "DB21018E A system error occurred. The command line
processor could not
continue processing." error.
why is it causing error..? am I missing anything?
Thanks
This is expected. The 'db2' process (the "front-end" process)
communicates with the 'db2bp' process (the "back-end" process), and
db2bp does all of the actual work. You can only have a single db2bp
associated with your shell, and db2bp can only communicate with a
single db2 process, which is why you're failing.
To do multiple exports in parallel, you need to have each run
inside a different shell:
#!/bin/ksh
function export {
file=$1
(
. /home/db2i21/sqllib/db2profile
db2 -tvf ${file}
) &
}
export extract_data_1.sql
export extract_data_2.sql
export extract_data_3.sql
wait
print "Extracts done."
On Dec 6, 2:30 pm, Ian <ianb...@mobileaudio.com> wrote:
> print "Extracts done."- Hide quoted text -
>
> - Show quoted text -
I wonder if a simpler version would be to just run:
for x in 1 2 3; do
sh -c "db2 -tvf extract_data_$x.sql" &
done
Another alternative that I like to use for long-running, parallelisable
tasks, is to use a makefile. It takes a lot of extra work to set up, but
scales incredibly well. Further, the job server can allow you to do some
really nifty things. e.g., if you had 20 such tasks, but you only wanted
three going at a time, "make -j3" would do that (once the makefile was
written). If, later, you upgraded your network, disk, CPU, whatever, and
decided that you could do more (or maybe 3 was tasking it too hard), you
could simply change the -j option to more (or less) for future runs. All
the hard work is already done for you.
Ok, writing a makefile isn't easy. But it's still orders of magnitude
easier than writing the parallel logic required for this type of
flexibility.
You *must* be a developer. ;-)
I once wrote a makefile (and a couple of helper scripts) to build a
database schema (one file for each object (table, index, key, view,
etc), complete with handling for dependencies. This was way back when
ALTER was practically useless (v7.2).
It was really effective, but because I didn't have a way to
automatically generate the makefile dependencies it was too much work
to maintain.