目的

线上一张表的字段长度变更

`sGuid` varchar(255) DEFAULT NULL COMMENT 'sGuid'

=》

`sGuid` varchar(512) DEFAULT NULL COMMENT 'sGuid'

方法

pt-online-schema-change --user=xxxx--password=xxxxxx --host=127.0.0.1 --port= \
--charset=utf8mb4 D=db_main,t=tb_main \
--alter "modify sGuid varchar(512) DEFAULT NULL COMMENT 'sGuid'" \
--no-check-alter --no-check-replication-filters --alter-foreign-keys-method=auto --recursion-method=none \
--critical-load="Threads_running=50" --max-load="Threads_running=100" \
--print --execute

执行时报错:

--25T11:: Error copying rows from `db_main`.`tb_main` to `db_main`.`_tb_main_new`: --25T11:: Copying rows caused a MySQL error :
Level: Warning
Code:
Message: Invalid utf8 character string: 'CE'

在 percona 官网找到原因: https://jira.percona.com/browse/PT-1528 ,这里直接贴出原因。

pt-online-schema-change could emit utf8 errors for binary PK:

Workaround specify latin1 charset for pt-o-s-c:

pt-online-schema-change --execute --charset=latin1 --chunk-size 2 --alter 'engine=innodb' D=test,t=brokenutf8alter

pt-o-s-c still processes the table correctly (utf8mb4 symbols stored in additional varchar field are valid after pt-o-s-c run). 4-byte changes also processed correctly by pt-o-s-c triggers.

Possible fix: use binary or hex literals instead of '?' substitution.

解决

用 latin1 字符集代替 utf8

pt-online-schema-change --user=xxxx--password=xxxxxx --host=127.0.0.1 --port= \
--charset=latin1 D=db_main,t=tb_main \
--alter "modify sGuid varchar(512) DEFAULT NULL COMMENT 'sGuid'" \
--no-check-alter --no-check-replication-filters --alter-foreign-keys-method=auto --recursion-method=none \
--critical-load="Threads_running=50" --max-load="Threads_running=100" \
--print --execute

pt-osc 变更时遇到 “MySQL error 1300” 报错问题解决的更多相关文章

  1. idea maven javaweb项目迁移时的maven和版本报错问题解决(可解决同类错误)

    项目中代码红线报版本不支持xx语法,只需要将java版本设置为当前机器使用的java版本即可 这里我使用的是idea自带的maven,如果是自己安装的maven需要在 home directory 处 ...

  2. MySQL主从1205报错【转】

    主从报错1205 Slave SQL thread retried transaction 10 time(s) in vain, giving up. Consider raising the va ...

  3. 安装hue时,make apps 编译报错

    安装hue时,make apps 编译报错 :"Error: must have python development packages for 2.6 or 2.7. Could not ...

  4. mysql执行update报错1175解决方法

    mysql执行update报错 update library set status=true where 1=1 Error Code: 1175. You are using safe update ...

  5. mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY

    mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY 今天开发的同事发来如下错误信息,最最简 ...

  6. ROS常见问题(一) 安装ROS时sudo rosdep init指令报错 最全解决方法

    安装ROS时sudo rosdep init指令报错: ERROR: cannot download default sources list from: https://raw.githubuser ...

  7. LoadRunner接口测试Error -27225报错解决

    今天依照规范写了一个接口测试脚本,再执行的时候报Error -27225,核对了接口字段和字段值没发现错误,百度搜Error -27225错误没有相关解释.这个问题经过溯源找到了问题的所在,为了互帮互 ...

  8. Mysql update in报错 [Err] 1093 - You can't specify target table 'company_info' for update in FROM clause

    Mysql update in报错 解决方案: [Err] 1093 - You can't specify target table 'company_info' for update in FRO ...

  9. dotnetcore ef 调用多个数据库时用户命令执行操作报错

    dotnetcore ef 调用多个数据库时用户命令执行操作报错 1.多个DbContext 时报错: 报错: More than one DbContext was found. Specify w ...

随机推荐

  1. QEventLoop以及QT事件循环

    1.一般我们的事件循环都是由exec()来开启的,例如下面的例子: 1 QCoreApplicaton::exec() 2 QApplication::exec() 3 QDialog::exec() ...

  2. 力扣152,53题,最大子序列求和and积

    本内容为最大子序列的求和和求积.采用DP的思路, 当前值加上小于之前值,则从该节点重新算起. 这个代码只能返回其结果值,但不能返回最后的子序列(待修改). class Solution: def ma ...

  3. linux shell下面的几种proxy方式

    设置ALL_PROXY环境变量 export ALL_PROXY=socks5://127.0.0.1:1080 支持socks5 http https 取消 export ALL_PROXY=&qu ...

  4. 关于密码重用参数PASSWORD_REUSE_TIME,PASSWORD_REUSE_MAX之间的关系及其演示

    转自: https://blog.51cto.com/carefree/1382811 测试环境:10.2.0.2.0测试用户:SCOTT测试用的三组密码:oracle1 oracle2 oracle ...

  5. java 跳出多重循环

    public class Main { public static void main(String[] args) { System.out.println("start"); ...

  6. 转 python多个命令同时执行.sh

    1.背景是 有三个脚本a.py, b.py, c.py 三个都是爬虫,里面都是while(true)方式运行的,不会主动运行结束. 每次启动他们,就需要: python a.py > logs/ ...

  7. 随机森林算法OOB_SCORE最佳特征选择

    RandomForest算法(有监督学习),可以根据输入数据,选择最佳特征组合,减少特征冗余:原理:由于随机决策树生成过程采用的Boostrap,所以在一棵树的生成过程并不会使用所有的样本,未使用的样 ...

  8. Cesium 禁止相机进入地底下[转]

    原文:https://blog.csdn.net/thor027/article/details/82455649 viewer.clock.onTick.addEventListener(funct ...

  9. 深入浅出ES6教程『async函数』

    大家好,本人名叫苏日俪格,大家叫我 (格格) 就好,在上一章节中我们学到了Symbol & generator的用法,下面我们一起来继续学习async函数: async [ə'zɪŋk]:这个 ...

  10. 001 安装mysql

    在安装docker之后,安装一个mysql的容器试试手.可以参考违章: URL: https://www.cnblogs.com/limingxie/p/8655457.html