ogg mysql表结构发生变化_golden gate同步的表结构修改检查

在Golden Gate同步过程中遇到错误OGG-01296,通常由于表结构变更引起。可以通过检查RORA_001.rpt文件定位问题,并临时注释掉对应map语句恢复复制进程。利用脚本检查源端数据库中DDL变更的表,通过计算LAST_DDL_TIME和CREATED的时间差来识别。对于新创建的表,如果不在源端配置中,也会导致同步错误。
摘要由CSDN通过智能技术生成

问题

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语句加--注释掉,启动复制进程,一般没有问题

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

检查源端数据库中修改了表结构的表,(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.txt

cat /dev/null > table_ddl_check.sql

cat  >> table_ddl_check.sql <

alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

col object_name for a20

set line 220

EOF

tabname=`cat table_name.0517.txt`

for tab in $tabname

do

echo "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.sql

done

检查结果

d5147b08e3189f8c259a66dda43e0b88.png

以上是修改了表结构的表,如果是重新建的表就没法查了,目标端和源端表结构不一样,同样报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  <

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

运行结果

54dcc80f5d5cc0e5093bc0be197b5918.png

---查看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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值