When using the backup command to back up the TiDB database, it prompts that the data is too long

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 使用backup命令备份tidb的数据库的时候提示数据太长

| username: ablewang_xiaobo

[TiDB Usage Environment] Production Environment
[TiDB Version] v4.0.9
[Encountered Problem: Problem Description and Impact]
When using the backup command to back up the database, the following prompt is received:
Backup failed: [types:1406]Data Too Long, field len 2, data len 4

| username: db_user | Original post link

Take a look at this, it should be the same issue.

| username: ablewang_xiaobo | Original post link

I have already checked, the backup command under sql> cannot add the ignore parameter, and there is no such parameter available in the backup command. So I don’t know what to do.

| username: dba-kit | Original post link

You can try executing br from the command line.

| username: dba-kit | Original post link

The BR command line documentation for version 4.0 is here: 使用 BR 命令行进行备份恢复 | PingCAP 归档文档站

| username: db_user | Original post link

Could you please let me know how large your tables are? First, back up the two tables below, then perform an analyze operation on all tables, and then back up again. If ignoring is not an option, recollecting the statistics should work. If analyze reports an error that the upper_bound length is insufficient, use the following operations:

ALTER TABLE mysql.stats_buckets MODIFY upper_bound LONGBLOB NOT NULL;
ALTER TABLE mysql.stats_buckets MODIFY lower_bound LONGBLOB;
ALTER TABLE mysql.stats_histograms MODIFY last_analyze_pos LONGBLOB DEFAULT NULL;
| username: ablewang_xiaobo | Original post link

This was modified a long time ago.

| username: Lucien-卢西恩 | Original post link

@ablewang_xiaobo Is there any issue with using the BR command for backup?

| username: ablewang_xiaobo | Original post link

I never had the chance to use BR, the client didn’t give me permission to log in later. :joy:

| username: ablewang_xiaobo | Original post link

There should be no problem with BR, and there are a few more available parameters in BR.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.