全部产品
Search
文档中心

数据传输服务 DTS:常见错误码及排查方法

更新时间:Jan 04, 2024

本文介绍DTS的常见错误码、报错原因及排查方法,帮助您进行初步的报错排查。文中提及的报错示例仅供参考,实际遇到的报错可能不完全一样。

错误码

报错说明

报错示例

可能的解决方法

DTS-51009

DTS写入模块读取DTS缓存模块时,显示连接超时。

DTS-31009: In process of processing data (recordRange: 5799806987638145024) failed cause: CriticalAnyAllException: capture-dstore: DTS-51009: Failed to fetch records from dstore TimeoutException: Failed to get offsets by times in 120000 ms

  • 原因:网络抖动等原因导致当前数据写入模块连接缓存模块超时。

  • 解决方法:您可以尝试重启任务,查看重启后任务是否恢复正常。

DTS-50019

DTS写入模块读取不到DTS缓存模块中指定时间点的数据。

DTS-31009: In process of processing data (recordRange: 9117052685537771520) failed cause: CriticalAnyAllException: capture-dstore: DTS-51009: Failed to fetch records from dstore CriticalAnyAllException: capture-dstore: DTS-50019: seek timestamp for topic [-0] with position [{"timestamp":1621516671, "offset":-1}] failed

  • 原因1:任务暂停过久,重启后DTS缓存模块中已没有相应位点(2021-5-20 21:17:51)的数据。

    说明

    报错提示显示的时间格式为Unix时间戳,您可用搜索引擎获取Unix时间戳转换工具,将Unix时间戳转换为UTC时间。

    解决方法1:请查看源库中用于增量数据解析的日志(如Binlog或Redolog等),其时间范围是否包括该时间点,如包括,请联系阿里云技术支持由后台尝试重新读取数据,若不包括,则需重新创建任务。

    解决方法2:需重新创建任务。后续执行任务时,请勿长时间暂停任务,暂停超过6个小时,任务将不能成功启动。

  • 原因2:任务失败过久,修复后DTS缓存模块中已没有相应位点的数据。

    解决方法:需重新创建任务。后续执行任务时,如遇任务报错,请尽快修复问题并恢复任务,避免任务因失败过久而无法恢复。

  • 原因3:全量迁移或全量同步期间,DTS本地会循环存储源库近24小时或者50 GB的数据日志,用于增量数据解析。如果全量迁移或全量同步持续时间较长,DTS本地可能已经清除全量任务启动后缓存的数据日志,导致用于增量解析的数据日志不完整。

    解决方法:需重新创建任务。创建任务前,请评估迁移或同步数据量,如数据量较大,建议拆分成多个迁移或同步任务。

DTS-30018,DTS-30019,DTS-70019

列不存在。

DTS-30019: Can not find column [column_in_source<-->column_in_target] in target table db_name.table_name

DTS-70019: Can not find column[column_in_source<-->column_in_target]in target table db_name.table_name

  • 可能原因

    • 原因1:配置任务时未选择结构迁移,从而导致源端和目标端的表结构不一致。

    • 原因2:任务配置后,在源端或目标端执行DDL修改了表结构,从而导致源端和目标端的表结构不一致。

  • 解决方法:调整源端和目标端的表结构,确保两端表结构一致。

说明

如果您的实际不符合以上原因,请尝试以下方法:

  • 尝试重启任务看能否恢复。

  • 尝试将报错的表从同步对象删除并重新添加,看能否恢复任务。

DTS-10046,DTS-30020

SQL执行异常。

DTS-10046: execute sql: CREATE TABLE if not exists`dts`.`table_name` ( `id` int(11) NOTNULL,`column1` bigint(20) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULTCHARSET=utf8 failed. Create TransactionTable failed. cause:MySQLSyntaxErrorException: CREATE command denied to user 'username'@'ip_address' for table 'table_name'

一般情况下,伴随此错误码,系统会同时输出数据库层面的具体报错信息。请参考具体报错内容,检查错误消息中的SQL语句并进行修复。

  • 可能原因:数据库账号缺失CREATE TABLE权限。

  • 解决方法:检查权限并赋予相应权限。

DTS-70004

SQL执行异常。

DTS-70004: execute statement failed: /*dts_id=dtsaaaaaaaaaa*/alter table`xxx`.`yyy` modify column `aaa` INT default 0 comment 'bbb' cause:SQLException: [15018, 2021030506452201000000420803151947572] modify column type is not supported, col=x, oldType=bigint, newType=int

一般情况下,目标库为AnalyticDB MySQL时,会出现示例报错信息。

  • 可能原因:链路不支持该类型的DDL操作,从而导致DDL执行失败。

  • 解决方法

    • 非整库同步:建议重新同步这张表(即先从同步对象中去掉,然后删除目标库的表,再把这张表加入到同步对象中)。DTS会重新进行包括Schema拉取的全量同步,这样会跳过此类型的DDL操作。

    • 整库同步:在AnalyticDB MySQL中新建一张表,表名要不同于报错的表,表结构需要和源表的表结构一致。通过INSERT INTO SELECT将源表中的数据写入新建表中,删除报错的表,然后通过RENAME将新表更名为报错的表名,重启DTS任务即可。

DTS-70004:execute statement failed: /*aaaaaaaaaaMysqlEngine(28)*/update `xxx`.`yyy` set... error detail message:Server shutdown in progress MySQLNonTransientConnectionException: Server shutdown in progress

  • 可能原因:目标库执行了SHUTDOWN操作。

  • 解决方法:确认目标库正常后,重启链路。

DTS-70004:execute statement failed: /*aaaaaaaaaaMysqlEngine(27)*/update `xxx`.`yyy` set... cause: SQLException: null, message from server: "Host '192.10.XX.XX' isnot allowed to connect to this MySQL server"

说明

修复完成后,需要重启任务。

DTS-70004: execute statement failed: /*bg6l15vf29l1b0vMysqlEngine(16)*/insertinto `xxx`.`yyy` ... error detail message:Table 'xxx.yyy' doesn't existMySQLSyntaxErrorException: Table 'xxx.yyy' doesn't exist

  • 可能原因:对应表不存在。

  • 解决方法

    • 检查该表在目标库是否已被删除。

    • 检查结构迁移中是否把该表已同步。

说明

修复完成后,需要重启任务。

o3z5bntMysqlEngine(0)*/insert into`xxx`.`yyy` ...error detail message:Column 'aaa' cannot be nullMySQLIntegrityConstraintViolationException: Column 'aaa' cannot be null

  • 可能原因:不符合数据库的完整性规范约束,例如,不允许为空的列插入了NULL。

  • 解决方法:检查表结构和DML语句涉及的记录,确保源和目的表结构一致,或者订正数据后重启任务。

DTS-70004: execute statement failed:/*s2gb356ds228bt8MysqlEngine(0)*/insert into `xxx`.`yyy` (`...`)values(...)error detail message:INSERT command denied to user'user'@'100.104.175.31' for table 'yyy' MySQLSyntaxErrorException: INSERTcommand denied to user 'user'@'100.104.175.31' for table 'yyy'

  • 可能原因:目标库账号相关权限不足。

  • 解决方法:检查目的库账号是否具有报错信息中提示的权限,如有缺失,补足权限后重启任务。

DTS-70002

无法连接数据库,或对应的库/表不存在。

DTS-70002: get table detail info failed after 151times (user: db_name, database:table_name) MySQLSyntaxErrorException: Table 'db_name.table_name'doesn't exist

  • 可能原因:结构迁移报错,导致相应表没有迁移到目标端,也未在目标端手动创建表结构。

  • 解决方法:根据报错信息中的内容检查库或表是否存在。若不存在:

    • 同步任务:将报错的表从同步对象中移除并重新添加,看能否恢复任务。

    • 迁移任务:重建链路。

DTS-60001

无法连接到源端数据库。

DTS-60001: Create connection failed (url:ip_address:port, user: username) cause: SQLException: Access denied for user'username'@'ip_address' (using password: YES)

  • 可能原因:用户名或密码不正确。

  • 解决方法:输入正确的用户名和密码,并重启任务。

说明

若您的实际不符合上述原因,请尝试以下方法:

DTS-61015

无法连接到源端数据库。

DTS-61015: Create connection failed(url:ip_address:port, user: username) cause:MySQLNonTransientConnectionException: Data source rejected establishment ofconnection, message from server: "Too many connections"

  • 可能原因:源端数据库连接数过多。

  • 解决方法:调整源端数据库的最大连接数,并重启任务。

说明

若您的实际不符合上述原因,请尝试以下方法:

DTS-71016

无法连接到目标端数据库。

  • 【示例1】DTS-71016: connect target failed (url: jdbc:mysql://ip_address:port?parameters)cause: MySQLNonTransientConnectionException: Data source rejected establishmentof connection, message from server: "Too many connections"

  • 【示例2】DTS-71016: connect target failed (url: jdbc:mysql://ip_address:port?parameters)cause: SQLException: null, message from server: "Host 'ip_address' isblocked because of many connection errors; unblock with 'mysqladminflush-hosts'"

  • 可能原因

    • 原因【示例1】:目标端数据库连接数过多。

    • 原因【示例2】:同一个IP地址在短时间内产生太多失败的数据库连接,从而导致连接被阻塞。

  • 解决方法

    • 解法【示例1】:调整目标端数据库的最大连接数,并重启任务。

    • 解法【示例2】:在目标端数据库侧修复问题(比如提高MAX_CONNECTION_ERRORS的值)后,重启任务。

DTS-10015

无法连接到Redis。

DTS-10015: unreachable redis network.JedisConnectionException: Could not get a resource from the poolJedisConnectionException: Failed connecting to ip_address:portConnectException: Connection timed out (Connection timed out)

  • 可能原因:Redis服务器异常,导致无法连接。

  • 解决方法:请检查Redis服务端状态,是否能正常连接,并修复Redis问题。

DTS-30005

内部处理中保存元数据信息失败

DTS-30005: save changed job progress info failed cause: SQLException:result content unexpected. expect 3 time 1, actually [2, 1, 1]

  • 可能原因:源库存在表名相同,但是大小写不同的表(如,TABLE和table),DTS当前不支持这种形式。

  • 解决方法:检查源库并核实业务逻辑,修改源库中其中1个表名,并重建任务。

DTS-30011

写数据异常

DTS-30011:put 2048 records error, currentRunningSQL:insert ignore into `xxx`.`yyy`(...), currentRunningRecordRange:{id:5362875948821643265,xxx.yyy,field:DefaultRecordField:{fieldName=aaa, dataType={typeName:BIGINT, typeId:-5, isLobType:false,encoding:null}, sourceDataType=null, aliases=[], defaultValue=null,nullable=false, unique=true, primary=true,generated=false},leftValue:1293615822270500864,rightValue:1311217506282770432,partition:null}cause: BatchUpdateException: The table 'yyy' is full SQLException: The table'yyy' is full

  • 可能原因

    • 原因1:磁盘空间满。

    • 原因2:表的大小已达上限。

  • 解决方法

    • 解法1:扩容磁盘后重启任务。

    • 解法2:在数据库层面解决表的上限值问题。解决后重启任务。

      说明

      针对MySQL数据库,表的上限值设置,可参考B.3.2.10 The table is full

DTS-30011: put 2048 records error, currentRunningSQL:insert ignore into`xxx`.`yyy`(...:{id:4958981218625388545,schema:xxx.yyy,field:DefaultRecordField:{fieldName=aaa, dataType={typeName:INTEGER, typeId:4, isLobType:false,encoding:null}, sourceDataType=null, aliases=[], defaultValue=null,nullable=false, unique=true, primary=true,generated=false},leftValue:512021,rightValue:1024022,partition:null} cause:BatchUpdateException: Lock wait timeout exceeded; try restarting transactionMySQLTransactionRollbackException: Lock wait timeout exceeded; try restartingtransaction

  • 可能原因:目标库存在锁等待超时。

  • 解决方法:目标库为MySQL时,可通过以下命令检查目标库锁的状况。

    SHOW FULL PROCESSLIST;
    SELECT
    * FROM innodb_trx;
    说明

    修复完成后,需要重启任务。

DTS-30011: put 2048 records error, currentRunningSQL:insert ignore into`xxx`.`yyy`(`...,currentRunningRecordRange:{id:4050997257913237860,schema:xxx.yyy,field:DefaultRecordField:{fieldName=id, dataType={typeName:BIGINT, typeId:-5, isLobType:false, encoding:null},sourceDataType=null, aliases=[], defaultValue=null, nullable=false,unique=true, primary=true,generated=false},leftValue:5424204045,rightValue:5424982251,partition:null}cause: SQLException: The MySQL server is running with the --read-only option soit cannot execute this statement

  • 可能原因:目标库的状态为Read-Only。

  • 解决方法

    • 通过SELECT @@read_only;语句检查目标库的状态是否为只读状态。

    • 通过SET GLOBAL read_only=0;语句关闭只读状态。

    说明

    关闭只读状态后,需要重启任务。

DTS-1051009

DTS解析MySQL数据库Binlog日志异常。

java.IOEException: java.lang.IllegalArgumentException: Valid type fail, Column:column_name,Type:type_number

  • 可能原因:Binlog中的表结构与DTS本地的表结构不一致,导致Binlog解析失败。出现这种表结构不一致主要的原因是:该表结构变更DDL语句未记录到Binlog中,导致DTS解析不到DDL,未更新本地存储的表结构。例如:执行SET SESSION sql_log_bin=0语句修改某个表的字段类型,比如INT(11)修改为BIGINT(20)。

  • 解决方法:请联系阿里云技术支持重新加载DTS本地存储的表结构。