目的

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

`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. Vue.js 十五分钟入门

    本文经授权转载,仅用于学习,版权归原作者所有. TypeScript 为 JavaScript 带来静态类型检查,让 JavaScript 编写中大型应用的时候可以应用工具来避免部分错误. Vue 很 ...

  2. node.js Error: connect EMFILE 或者 getaddrinfo ENOTFOUND

    Error: getaddrinfo ENOTFOUND] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo' Error: c ...

  3. 《挑战30天C++入门极限》新手入门:C/C++中的结构体

        新手入门:C/C++中的结构体 什么是结构体? 简单的来说,结构体就是一个可以包含不同数据类型的一个结构,它是一种可以自己定义的数据类型,它的特点和数组主要有两点不同,首先结构体可以在一个结构 ...

  4. 解释下Http协议

    HTTP是一个属于应用层的面向对象的协议,由于其简捷.快速的方式,适用于分布式超媒体信息系统. HTTP协议的主要特点可概括如下: 1.支持客户/服务器模式. 2.简单快速:客户向服务器请求服务时,只 ...

  5. 常用的web api总结

    1.querySelector 获取指定元素中匹配css选择器的元素. // 作用在document document.querySelector("#nav"); // 获取文档 ...

  6. 胶囊网络 -- Capsule Networks

    胶囊网络是 vector in vector out的结构,最后对每个不同的类别,输出不一个向量,向量的模长表示属于该类别的概率. 例如,在数字识别中,两个数字虽然重叠在一起,Capsule中的两个向 ...

  7. Qt动画框架The Animation Framework

    动画框架是Kinetic(运动)项目的一部分,它的目标是提供一中简单的方法创建动画的和流畅的GUI.借助Qt动画属性,可以提供非常自由的动画窗体组件和其他对象(QObjects).动画框架也能被用于图 ...

  8. 扩展和嵌入 Python 解释器 用 C 或 C++ 编写模块以使用新模块来扩展 Python 解释器的功能 定义新的函数\对象类型\方法。 将 Python 解释器嵌入到另一个应用程序中

    // https://python3-cookbook.readthedocs.io/zh_CN/latest/c15/p02_write_simple_c_extension_module.html ...

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

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

  10. python3 selenium模块Chrome设置代理ip的实现

    python3 selenium模块Chrome设置代理ip的实现 selenium模块Chrome设置代理ip的实现代码: from selenium import webdriver chrome ...