Svenson's  Bulletin Board Forum Index Svenson's Bulletin Board
Bulletin Board for boat building and model airplane building enthusiasts.
 
AlbumAlbum   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

script to replicate tables accross databases

 
Post new topic   Reply to topic    Svenson's Bulletin Board Forum Index -> DB2
View previous topic :: View next topic  
Author Message
craig
Site Admin


Joined: 19 Feb 2006
Posts: 40

PostPosted: Fri Jun 16, 2006 7:22 am    Post subject: script to replicate tables accross databases Reply with quote

#!/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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Svenson's Bulletin Board Forum Index -> DB2 All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group