1.1需求
OGG软件,源端目标端环境是异构的情况下,源端新增字段后(表结构变更),目标端需要手工同步DDL操作后,还需要更新Def文件,如果是大量的表源端可以根据抽取表进行def文件全部更新,如果是少量1个表结构变更的情况,希望快速在源端输出最新def文件!!!
1.2脚本
[oracle@aux02 ~]$ cat getdef.sh #!/bin/sh #生成OGG DEF文件 #sample: getdef FUJIAN C_CUST_AGREEMENT a=$(echo $1| tr 'A-Z' 'a-z' ) b=$(echo $2| tr 'A-Z' 'a-z' ) A=$(echo $1| tr 'a-z' 'A-Z' ) B=$(echo $2| tr 'a-z' 'A-Z' ) #echo a=$A, b=$B #echo a=$a, b=$b PRMFILE=/tmp/${a}_${b}_$(date +'%Y%m%d').prm DEFFILE=/tmp/${a}_${b}_$(date +'%Y%m%d').def echo using parameter file: $PRMFILE cat > $PRMFILE <<EOF defsfile $DEFFILE,purge USERID goldengate, PASSWORD SGcc95598 TABLE $A.$B; EOF /sh_ogg/defgen paramfile $PRMFILE RET=$? if [ $RET -ne 0 ]; then exit $RET fi echo generate definition file: $DEFFILE cat $DEFFILE
--源端输出需要的某个表的最新DEF文件
--目标端手工VI替换