GoldenGate cloning

Would you to clone some GoldenGate home, but you have too many extract / pump / replicats?

It will take an eternal day?

Try to use this script:

./ggsci << EOF > gg_config.out
info all
EOF

#CHECK EXTRACT CONFIG
cat gg_config.out|egrep "EXTRACT"|awk {' print $3 '}|while read line;
do
echo "--EXTRACT "$line;
./ggsci << EOF > $line.out
        info $line detail
EOF
        TRAILFILE_TEMP=`cat $line.out|grep "Log Read Checkpoint"|awk {' print $5 '}`
        STRING_FIND="dirdat"
        cutpos=`awk -v a="$TRAILFILE_TEMP" -v b="$STRING_FIND" 'BEGIN{print index(a,b)}'`
        TRAILFILE=`echo $TRAILFILE_TEMP|cut -c $cutpos-11`
        echo "add extract $line, exttrailsource ./$TRAILFILE, begin now"
        cat $line.out|grep RMTTRAIL|awk {' print $1 '}|while read rmttrail; do
                echo "add rmttrail $rmttrail, extract $line"
        done
rm $line.out
done

#CHECK REPLICAT CONFIG
cat gg_config.out|egrep "REPLICAT"|awk {' print $3 '}|while read line;
do
echo "--REPLICAT "$line;
./ggsci << EOF > $line.out
        info $line detail
EOF
        CHECKPOINT=`cat $line.out|grep "Checkpoint table"|awk {' print $3 '}`
        TRAILFILE=`cat $line.out|grep "Log Read Checkpoint"|awk {' print $5 '}`
        echo "--REPLICAT"
        echo "add replicat "$line", exttrail "$TRAILFILE", checkpoint table "$CHECKPOINT
rm $line.out
done

It will return GoldenGate commnads to add all process in another GoldenGate home.

Work fine with pump / replicat.

so, obey in a output file.

--EXTRACT P_CUST1
add extract P_CUST1, exttrailsource ./dirdat/j0, begin now
add rmttrail ./dirdat/j0, extract P_CUST1
--EXTRACT P_CUST2
add extract P_CUST2, exttrailsource ./dirdat/j0, begin now
add rmttrail ./dirdat/j1, extract P_CUST2
--EXTRACT P_CUST3
add extract P_CUST3, exttrailsource ./dirdat/j0, begin now
add rmttrail ./dirdat/xx, extract P_CUST3
--REPLICAT R_REP1
add replicat R_REP1, exttrail ./dirdat/m6, checkpoint table GGATE.OGGCKPT
--REPLICAT R_REP2
add extract R_REP2, exttrailsource ./dirdat/cv, begin now
--REPLICAT R_REP3
add replicat R_REP3, exttrail ./dirdat/cv, checkpoint table GGATE.OGGCKPT
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s