craig Site Admin
Joined: 19 Feb 2006 Posts: 40
|
Posted: Fri Jun 16, 2006 7:22 am Post subject: script to replicate tables accross databases |
|
|
#!/bin/ksh
mkdir -p $HOME/tmp
cd $HOME/tmp
[ $? -ne 0 ] && exit 1
export f=$1
[ $# -ne 1 ] && {
echo "usage: expimp table"
exit 1
}
{
db2 -o- connect to qdb2 user odfim using odfim
mkdir -p lobs/$f
db2 export to $f.ixf of ixf lobs TO lobs/$f select \* from $f # where 1 = 2
db2 -o- connect reset
db2 -o- connect to owlods1
db2 import from $f.ixf of ixf \
lobs from lobs/$f \
commitcount 100000 \
replace_create into $f \
in d2owl_04kt_01 \
index in d2owl_04ki_01
db2 runstats on table $f with distribution \
and detailed indexes all shrlevel change
db2 -o- grant control on table $f to user owladm
db2 -o- connect reset
} 2>&1 | tee ~/expimp.log |
|