golden gate同步的表结构修改检查

来源:这里教程网 时间:2026-03-03 15:37:43 作者:

    问题

golden gate目标端检查发现错误 ogg-01296

    2.view report RORA_001找到错误ogg-01296对应的map表名可以使用如下方式快速检查 Tail -3000 RORA_001.rpt >> /tmp/ RORA_001.rpt Cat  /tmp/ RORA_001.rpt |grep -i OGG-  会出现ogg-01296错误

    edit report RORA_001在对应的map语句加--注释掉,启动复制进程,一般没有问题

    如果修改的表比较多,可以使用脚本检查

    itpub_ogg_表结构修改巡检脚本.txt      检查源端数据库中修改了表结构的表,(LAST_DDL_TIME-CREATED)*24*60代表分钟数 ---------- cat  /home/ogg/dirprm/eora_001.prm |grep -i table |awk '{print $2}'|cut -d ";" -f1 > /home/ogg/table_name.0517.txtcat /dev/null > table_ddl_check.sql cat  >> table_ddl_check.sql <<EOFalter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';col object_name for a20set line 220EOFtabname=`cat table_name.0517.txt`for tab in $tabnamedoecho "select owner,OBJECT_NAME,CREATED,LAST_DDL_TIME,(LAST_DDL_TIME-CREATED)*24*60 time_sicne_ddl  from dba_objects where owner='`echo $tab|cut -d "." -f1`' and OBJECT_NAME='`echo $tab|cut -d "." -f2`' and (LAST_DDL_TIME-CREATED)*24*60>0;" >> table_ddl_check.sqldone 检查结果 以上是修改了表结构的表,如果是重新建的表就没法查了,目标端和源端表结构不一样,同样报0gg-01296错误以下是查看当天新建的表 查看所有ogg源端配置中的用户当日新建的表 建立测试表create table ggs.t0517(id number); cat  /home/ogg/dirprm/eora_001.prm |grep table |awk '{print $2}'|cut -d "," -f1 |cut -d "." -f1 >> /tmp/schema.txt    --得到抽取进程表的所有schema rm -f  /tmp/1.sql  cat >>/tmp/1.sql  <<EOF alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'; set line 220 col object_name for a20 EOF schema=`cat /tmp/schema.txt|sort |uniq`  for user in $schema  do  echo "select owner,OBJECT_NAME,CREATED,LAST_DDL_TIME, (LAST_DDL_TIME-CREATED)*24*60 time_sicne_ddl from dba_objects where owner='$user'  and trunc(CREATED)=trunc(sysdate);">> /tmp/1.sql done运行结果 ---查看scott用户15天之前建立的表 select owner,OBJECT_NAME,CREATED,LAST_DDL_TIME, (LAST_DDL_TIME-CREATED)*24*60 time_sicne_ddl,trunc(sysdate-CREATED)  from dba_objects where owner='SCOTT'  and trunc(sysdate-CREATED)>=15; 

相关推荐