【问题描述】
易鲸捷migrationtool(简称MT工具)工具,从异构数据库(mysql)迁移到EsgynDB数据库,提示:外键约束迁移失败,错误信息如下:
Remote Process: \n04.esgynnode.com:2.$Z0002000L73. *** ERROR[1143] Validation for constraint TRAFODION.PDKK.JT_KK_FK failed; incompatible data exists in referencing base table JT_KK and referenced base table JT_PCS. To display the data that violates the constraint, please use the following DML statement: select count(*) from "TRAFODION"."PDKK"."JT_KK" where not (("PCSDM") in (select "PCSDM" from "TRAFODION"."PDKK"."JT_PCS")) and "PCSDM" is not null ; [2020-08-07 10:48:18]
【问题原因】
MT工具迁移是先迁移表结构,然后迁移数据,最后迁移外键约束; MT迁移会读取元数据,数据迁入后,系统表中的元数据可能没有及时更新,导致主外键数据不能匹配,导致外键迁移失败;
【问题解决】
方法一:更新或者清空元数据信息(cleanup table xxx),再使用MT迁移外键;
方法二:直接使用语句创建外键;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69985104/viewspace-2726633/ ,如需转载,请注明出处,否则将追究法律责任。