金融行业实践:迁移 MySQL 数据到 OceanBase 集群

2024年 5月 7日 61.4k 0

作者简介:张霁:数据库架构师。

掌握从 MySQL 向 OceanBase 迁移数据的基本方法:mysqldump、datax 、canal 等

工具准备

mysqldump

datax

工具安装说明:

mysqldump 需要使用 MySQL5.6/5.7 中的,使用 MySQL 8.0 版本的会出现报错。

datax 工具需要使用安装JDK 8。

使用 mysqldump 迁移数据

导出数据

#导出指定数据库的表结构(不包括数据)
[vlog@MXH-114-12-201 vlog]$ mysqldump -h 10.114.12.193 -uroot -P3306 -p1q2w3e4R@ -d ddf70m --compact > 193ddf70m.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

#导出指定数据库的表数据(不包括结构)
[vlog@MXH-114-12-201 vlog]$ mysqldump -h 10.114.12.193 -uroot -P3306 -p1q2w3e4R@ -t ddf70m > 193ddf70mData.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

导出文件结构说明:

这个导出来的脚本有几个特征:

视图的定义也会在里面,但是会以注释 /!/。视图我们不关注,这部分内容可以删除。

会有一些特别的语法 OceanBase MYSQL 会不支持,但是不影响,需要替换掉其中部分。比如说变量 SQL_NOTES,DEFINER 语句等。

下面这个示例就是导出的脚本里有一个 MAX_ROWS= 的设置,这个是 MySQL 特有的,OceanBase MySQL 没有这个问题,也不需要这个设置,不支持这个语法,会报错。

/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client  = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE dtf_lock (
 TB_NAME varchar(50) NOT NULL,
 PKS_VALUE varchar(200) NOT NULL,
 XID varchar(50) NOT NULL,
 GMT_MODIFIED timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
 DATA_CENTER varchar(50) DEFAULT NULL,
 PRIMARY KEY (TB_NAME,PKS_VALUE )
) ENGINE=InnoDB DEFAULT CHARSET=utf8 MAX_ROWS=4294967295;
需要把所有 MAX_ROWS= 以及后面部分注释掉。使用批量替换技术。如在 vim 中使用 :%s/MAX_ROWS=/; -- MAX_ROWS=/g 。

注意:上面导出的 SQL 中表名是大写,说明源端 MySQL 里设置表名默认很可能是大小写敏感。因此目标 OceanBase MySQL 租户也要设置。一般都会设置为大小写不敏感,可针对性做出

在导出的表结构语句里,可能包含外键。在导入 OceanBase MySQL 里时,如果外键依赖的表没有创建时,导入脚本会报错。因此导入之前需要将外键检查约束先禁用掉。

MySQL [oceanbase]> set global foreign_key_checks=off;
Query OK, 0 rows affected (0.01 sec)

MySQL [oceanbase]> show global variables like '%foreign%';
+--------------------+-------+
| Variable_name   | Value |
+--------------------+-------+
| foreign_key_checks | OFF |
+--------------------+-------+
1 row in set (0.00 sec)
修改后,退出会话,重新登录。 

导入数据

将前边导出的库表结构和数据传输到OceanBase集群机器。也可以不传输,使用本地安装的mysql client/ob client。

整体原则就是执行导入命令所在机器能读取到文件。

登录OceanBase

[vlog@MXH-114-12-201 vlog]$ mysql -h10.144.2.111 -uroot@tpcc -P2883 -p -c -A oceanbase
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32769
Server version: 5.6.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

创建导入数据库

mysql> create database loaddata;
Query OK, 1 row affected (0.04 sec)
mysql> use loaddata
Database changed

执行导入表结构

mysql> source 193ddf70m.sql;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.09 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.08 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.09 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.03 sec)

Query OK, 0 rows affected (0.11 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.03 sec)

Query OK, 0 rows affected (0.11 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.03 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.09 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.08 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected (0.11 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.03 sec)

Query OK, 0 rows affected (0.11 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.03 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 0 rows affected (0.10 sec)

导入表数据

说明:

视图的定义也会在里面,但是会以注释 /!/。视图我们不关注,这部分内容可以删除。或者忽略错误。

会有一些特别的语法 OceanBase MYSQL 会不支持,但是不影响,需要替换掉其中部分。比如说变量 SQL_NOTES,DEFINER 语句等。

mysql> source 193ddf70mData.sql;
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

ERROR 1193 (HY000): Unknown system variable 'SQL_NOTES'
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 5 rows affected (0.11 sec)
Records: 5 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.01 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 1 row affected (0.03 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.01 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 4 rows affected (0.02 sec)
Records: 4 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 100 rows affected (0.02 sec)
Records: 100 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 100 rows affected (0.01 sec)
Records: 100 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 100 rows affected (0.01 sec)
Records: 100 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 100 rows affected (0.01 sec)
Records: 100 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 2 rows affected (0.03 sec)
Records: 2 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 16124 rows affected (1.49 sec)
Records: 16124 Duplicates: 0 Warnings: 0

Query OK, 16136 rows affected (1.52 sec)
Records: 16136 Duplicates: 0 Warnings: 0

Query OK, 16121 rows affected (1.42 sec)
Records: 16121 Duplicates: 0 Warnings: 0

Query OK, 16133 rows affected (1.53 sec)
Records: 16133 Duplicates: 0 Warnings: 0

Query OK, 16214 rows affected (1.53 sec)
Records: 16214 Duplicates: 0 Warnings: 0

Query OK, 16383 rows affected (1.55 sec)
Records: 16383 Duplicates: 0 Warnings: 0

Query OK, 2889 rows affected (0.23 sec)
Records: 2889 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 16119 rows affected (1.15 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.22 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.19 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.18 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.18 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.20 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.19 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.18 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.18 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.18 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.18 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 16119 rows affected (0.19 sec)
Records: 16119 Duplicates: 0 Warnings: 0

Query OK, 11372 rows affected (0.92 sec)
Records: 11372 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 20929 rows affected (1.88 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.64 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.61 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.60 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.60 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.59 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.62 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.61 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.62 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.62 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.62 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.65 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.65 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.64 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.63 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.65 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.68 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.65 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.64 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.64 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.64 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.64 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.64 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.67 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.65 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.68 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.65 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.64 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.66 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 20929 rows affected (0.65 sec)
Records: 20929 Duplicates: 0 Warnings: 0

Query OK, 16337 rows affected (1.50 sec)
Records: 16337 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 16124 rows affected (1.50 sec)
Records: 16124 Duplicates: 0 Warnings: 0

Query OK, 16136 rows affected (1.48 sec)
Records: 16136 Duplicates: 0 Warnings: 0

Query OK, 16121 rows affected (1.54 sec)
Records: 16121 Duplicates: 0 Warnings: 0

Query OK, 16133 rows affected (1.47 sec)
Records: 16133 Duplicates: 0 Warnings: 0

Query OK, 16214 rows affected (1.50 sec)
Records: 16214 Duplicates: 0 Warnings: 0

Query OK, 16383 rows affected (1.51 sec)
Records: 16383 Duplicates: 0 Warnings: 0

Query OK, 2889 rows affected (0.23 sec)
Records: 2889 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 16124 rows affected (1.03 sec)
Records: 16124 Duplicates: 0 Warnings: 0

Query OK, 16136 rows affected (1.07 sec)
Records: 16136 Duplicates: 0 Warnings: 0

Query OK, 16121 rows affected (1.06 sec)
Records: 16121 Duplicates: 0 Warnings: 0

Query OK, 16133 rows affected (0.99 sec)
Records: 16133 Duplicates: 0 Warnings: 0

Query OK, 16214 rows affected (1.08 sec)
Records: 16214 Duplicates: 0 Warnings: 0

Query OK, 16383 rows affected (1.08 sec)
Records: 16383 Duplicates: 0 Warnings: 0

Query OK, 2889 rows affected (0.16 sec)
Records: 2889 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 12450 rows affected (1.12 sec)
Records: 12450 Duplicates: 0 Warnings: 0

Query OK, 2995 rows affected (0.22 sec)
Records: 2995 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 17166 rows affected (1.09 sec)
Records: 17166 Duplicates: 0 Warnings: 0

Query OK, 16369 rows affected (1.02 sec)
Records: 16369 Duplicates: 0 Warnings: 0

Query OK, 16258 rows affected (1.07 sec)
Records: 16258 Duplicates: 0 Warnings: 0

Query OK, 16342 rows affected (1.02 sec)
Records: 16342 Duplicates: 0 Warnings: 0

Query OK, 17225 rows affected (1.04 sec)
Records: 17225 Duplicates: 0 Warnings: 0

Query OK, 16640 rows affected (1.03 sec)
Records: 16640 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 18806 rows affected (1.17 sec)
Records: 18806 Duplicates: 0 Warnings: 0

Query OK, 18990 rows affected (1.12 sec)
Records: 18990 Duplicates: 0 Warnings: 0

Query OK, 18999 rows affected (1.13 sec)
Records: 18999 Duplicates: 0 Warnings: 0

Query OK, 18985 rows affected (1.15 sec)
Records: 18985 Duplicates: 0 Warnings: 0

Query OK, 18728 rows affected (1.11 sec)
Records: 18728 Duplicates: 0 Warnings: 0

Query OK, 5492 rows affected (0.31 sec)
Records: 5492 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 16124 rows affected (1.43 sec)
Records: 16124 Duplicates: 0 Warnings: 0

Query OK, 16136 rows affected (1.46 sec)
Records: 16136 Duplicates: 0 Warnings: 0

Query OK, 16121 rows affected (1.46 sec)
Records: 16121 Duplicates: 0 Warnings: 0

Query OK, 16133 rows affected (1.51 sec)
Records: 16133 Duplicates: 0 Warnings: 0

Query OK, 16214 rows affected (1.43 sec)
Records: 16214 Duplicates: 0 Warnings: 0

Query OK, 16383 rows affected (1.46 sec)
Records: 16383 Duplicates: 0 Warnings: 0

Query OK, 2889 rows affected (0.21 sec)
Records: 2889 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 16124 rows affected (1.52 sec)
Records: 16124 Duplicates: 0 Warnings: 0

Query OK, 16136 rows affected (1.38 sec)
Records: 16136 Duplicates: 0 Warnings: 0

Query OK, 16121 rows affected (1.50 sec)
Records: 16121 Duplicates: 0 Warnings: 0

Query OK, 16133 rows affected (1.55 sec)
Records: 16133 Duplicates: 0 Warnings: 0

Query OK, 16214 rows affected (1.43 sec)
Records: 16214 Duplicates: 0 Warnings: 0

Query OK, 16383 rows affected (1.65 sec)
Records: 16383 Duplicates: 0 Warnings: 0

Query OK, 2889 rows affected (0.23 sec)
Records: 2889 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.01 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 16124 rows affected (1.44 sec)
Records: 16124 Duplicates: 0 Warnings: 0

Query OK, 16136 rows affected (1.38 sec)
Records: 16136 Duplicates: 0 Warnings: 0

Query OK, 16121 rows affected (1.55 sec)
Records: 16121 Duplicates: 0 Warnings: 0

Query OK, 16133 rows affected (1.57 sec)
Records: 16133 Duplicates: 0 Warnings: 0

Query OK, 16214 rows affected (1.45 sec)
Records: 16214 Duplicates: 0 Warnings: 0

Query OK, 16383 rows affected (1.58 sec)
Records: 16383 Duplicates: 0 Warnings: 0

Query OK, 2889 rows affected (0.22 sec)
Records: 2889 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 16124 rows affected (1.66 sec)
Records: 16124 Duplicates: 0 Warnings: 0

Query OK, 16136 rows affected (1.45 sec)
Records: 16136 Duplicates: 0 Warnings: 0

Query OK, 16121 rows affected (1.51 sec)
Records: 16121 Duplicates: 0 Warnings: 0

Query OK, 16133 rows affected (1.48 sec)
Records: 16133 Duplicates: 0 Warnings: 0

Query OK, 16214 rows affected (1.62 sec)
Records: 16214 Duplicates: 0 Warnings: 0

Query OK, 16383 rows affected (1.52 sec)
Records: 16383 Duplicates: 0 Warnings: 0

Query OK, 2889 rows affected (0.24 sec)
Records: 2889 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 12450 rows affected (1.03 sec)
Records: 12450 Duplicates: 0 Warnings: 0

Query OK, 2995 rows affected (0.20 sec)
Records: 2995 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 12450 rows affected (1.05 sec)
Records: 12450 Duplicates: 0 Warnings: 0

Query OK, 2995 rows affected (0.21 sec)
Records: 2995 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '--' at line 1
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'DISABLE KEYS */' at line 1
Query OK, 12450 rows affected (0.99 sec)
Records: 12450 Duplicates: 0 Warnings: 0

Query OK, 2995 rows affected (0.20 sec)
Records: 2995 Duplicates: 0 Warnings: 0

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ENABLE KEYS */' at line 1
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

ERROR 1193 (HY000): Unknown system variable 'sql_notes'
Query OK, 0 rows affected (0.00 sec)

出现报错原因分析:

You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘–’ at line 1

数据文件中有–注释信息,导入到OceanBase会报错。可以忽略,并不影响数据导入。

You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘ENABLE KEYS */’ at line 1

mysqldump 导出的数据初始化 SQL 里会首先将表锁住,禁止其他会话写。这里会出现该报错,但不影响数据导入。

You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘DISABLE KEYS */’ at line 1

mysqldump 导出的数据初始化 SQL 里会首先将表锁住,禁止其他会话写。这里会出现该报错,但不影响数据导入。

Unknown system variable ‘sql_notes’

变量 SQL_NOTES,DEFINER 语句等 OceanBase MYSQL 会不支持,但是不影响,需要替换掉其中部分。这里会出现该报错,但不影响数据导入。

数据检验

MySQL端数据量校验

[vlog@MXH-114-12-201 tmp]$ mysql -h 10.114.12.193 -uroot -P3306 -p1q2w3e4R@ 
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3571493
Server version: 5.7.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use ddf70m
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select count(1) from x_a;
+----------+
| count(1) |
+----------+
| 100000 |
+----------+
1 row in set (0.01 sec)

OceanBase 数据量校验

[admin@ocp ~]$ mysql -h10.144.2.111 -uroot@tpcc -P2883 -p -c -A oceanbase
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [oceanbase]> use loaddata
Database changed
MySQL [loaddata]> select count(1) from x_a;
+----------+
| count(1) |
+----------+
| 100000 |
+----------+
1 row in set (0.05 sec)

MySQL [loaddata]>

使用 DataX 迁移数据

工具安装

下载 DataX 工具

DataX 是阿里云 DataWorks数据集成 的开源版本,在阿里巴巴集团内被广泛使用的离线数据同步工具/平台。DataX 实现了包括 MySQL、Oracle、OceanBase、SqlServer、Postgre、HDFS、Hive、ADS、HBase、TableStore(OTS)、MaxCompute(ODPS)、Hologres、DRDS 等各种异构数据源之间高效的数据同步功能。

GitHub地址如下:

https://github.com/alibaba/DataX

由于未在 GitHub 上发布具体版本,所以需要在其他网址下载。我这里选择阿里官方的另一个地址进行下载。

下载地址如下:

http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz

安装 DataX

#直接解压即可:
tar -xf datax.tar.gz
删除datax中的隐藏文件
find ./datax/plugin -name ".*" | xargs rm -f

配置模板

查看配置模板

[vlog@MXH-114-12-201 vlog]$ python ./datax/bin/datax.py -r mysqlreader -w oceanbasev10writer

DataX (DATAX-OPENSOURCE-3.0), From Alibaba !
Copyright (C) 2010-2017, Alibaba Group. All Rights Reserved.


Please refer to the mysqlreader document:
   https://github.com/alibaba/DataX/blob/master/mysqlreader/doc/mysqlreader.md 

Please refer to the oceanbasev10writer document:
   https://github.com/alibaba/DataX/blob/master/oceanbasev10writer/doc/oceanbasev10writer.md 
 
Please save the following configuration as a json file and use
   python {DATAX_HOME}/bin/datax.py {JSON_FILE_NAME}.json 
to run the job.

{
  "job": {
    "content": [
      {
        "reader": {
          "name": "mysqlreader", 
          "parameter": {
            "column": [], 
            "connection": [
              {
                "jdbcUrl": [], 
                "table": []
              }
            ], 
            "password": "", 
            "username": "", 
            "where": ""
          }
        }, 
        "writer": {
          "name": "oceanbasev10writer", 
          "parameter": {
            "column": [], 
            "connection": [
              {
                "jdbcUrl": "", 
                "table": []
              }
            ], 
            "obWriteMode": "", 
            "password": "", 
            "username": ""
          }
        }
      }
    ], 
    "setting": {
      "speed": {
        "channel": ""
      }
    }
  }
}

创建配置文件,写入配置文件,并修改

生产配置文件

[vlog@MXH-114-12-201 vlog]$ python ./datax/bin/datax.py -r mysqlreader -w oceanbasev10writer > MySQL2OeanBase.json

修改配置文件

[vlog@MXH-114-12-201 datax]$ vi MySQL2OeanBase.json 
{
  "job": {
    "content": [
      {
        "reader": {
          "name": "mysqlreader", 
          "parameter": {
            "column": [], 
            "connection": [
              {
                "jdbcUrl": [jdbc:mysql://10.114.12.193:3306/ddf70m?useUnicode=true&characterEncoding=utf8], 
                "table": [x_a]
              }
            ], 
            "password": "1q2w3e4R@", 
            "username": "root", 
            "where": ""
          }
        }, 
        "writer": {
          "name": "oceanbasev10writer", 
          "parameter": {
            "column": [], 
            "connection": [
              {
                "jdbcUrl": "||_dsc_ob10_dsc_||obcluster:tpcc||_dsc_ob10_dsc_||jdbc:mysql://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf8", 
                "table": [x_a]
              }
            ], 
            "obWriteMode": "", 
            "password": "transfer", 
            "username": "transfer"
          }
        }
      }
    ], 
    "setting": {
      "speed": {
        "channel": "16"
      }
    }
  }
}

执行迁移

创建目标库和表结构

由于 Datax 是迁移工具,并不支持将表结构直接迁移到目标端。所以需要提前在目标端创建库表。

[admin@ocp ~]$ mysql -h10.144.2.106 -utransfer@tpcc -P2883 -ptransfer -c -A oceanbase
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [oceanbase]> create database datax;
Query OK, 1 row affected (0.04 sec)

MySQL [oceanbase]> use datax
Database changed
MySQL [datax]> CREATE TABLE x_a (
  -> ACCTNO varchar(20) NOT NULL,
  -> CLIENTNO varchar(20) NOT NULL,
  -> ACCTCLASS int(11) DEFAULT '1',
  -> LEDGERTYPE char(1) DEFAULT 'I',
  -> ORGNO varchar(20) DEFAULT NULL,
  -> LEGALPERSON varchar(20) DEFAULT NULL,
  -> XID varchar(50) DEFAULT NULL,
  -> PRIMARY KEY (ACCTNO ),
  -> KEY INDEX_X_A_CLIENTNO (CLIENTNO ),
  -> KEY INDEX_X_A_ORGNO (ORGNO )
  -> ) ;
Query OK, 0 rows affected (0.14 sec)

执行迁移

[vlog@MXH-114-12-201 datax]$ python bin/datax.py job/MySQL2OeanBase.json

DataX (DATAX-OPENSOURCE-3.0), From Alibaba !
Copyright (C) 2010-2017, Alibaba Group. All Rights Reserved.


2022-02-24 09:37:37.913 [main] INFO VMInfo - VMInfo# operatingSystem class => sun.management.OperatingSystemImpl
2022-02-24 09:37:37.919 [main] INFO Engine - the machine info => 

    osInfo: Oracle Corporation 1.8 25.181-b13
    jvmInfo:    Linux amd64 3.10.0-862.el7.x86_64
    cpu num:    12

    totalPhysicalMemory:  -0.00G
    freePhysicalMemory:  -0.00G
    maxFileDescriptorCount: -1
    currentOpenFileDescriptorCount: -1

    GC Names    [PS MarkSweep, PS Scavenge]

    MEMORY_NAME          | allocation_size        | init_size           
    PS Eden Space         | 256.00MB           | 256.00MB            
    Code Cache          | 240.00MB           | 2.44MB             
    Compressed Class Space    | 1,024.00MB          | 0.00MB             
    PS Survivor Space       | 42.50MB            | 42.50MB            
    PS Old Gen          | 683.00MB           | 683.00MB            
    Metaspace           | -0.00MB            | 0.00MB             


2022-02-24 09:37:37.935 [main] INFO Engine - 
{
    "content":[
        {
            "reader":{
                "name":"mysqlreader",
                "parameter":{
                    "column":[
                        "*"
                    ],
                    "connection":[
                        {
                            "jdbcUrl":[
                                "jdbc:mysql://10.114.12.193:3306/ddf70m?useUnicode=true&characterEncoding=utf8"
                            ],
                            "table":[
                                "x_a"
                            ]
                        }
                    ],
                    "password":"*********",
                    "username":"root",
                    "where":""
                }
            },
            "writer":{
                "name":"oceanbasev10writer",
                "parameter":{
                    "column":[
                        "*"
                    ],
                    "connection":[
                        {
                            "jdbcUrl":"||_dsc_ob10_dsc_||obcluster:tpcc||_dsc_ob10_dsc_||jdbc:mysql://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf-8",
                            "table":[
                                "x_a"
                            ]
                        }
                    ],
                    "obWriteMode":"insert",
                    "password":"********",
                    "username":"transfer"
                }
            }
        }
    ],
    "setting":{
        "speed":{
            "channel":"16"
        }
    }
}

2022-02-24 09:37:37.949 [main] WARN Engine - prioriy set to 0, because NumberFormatException, the value is: null
2022-02-24 09:37:37.950 [main] INFO PerfTrace - PerfTrace traceId=job_-1, isEnable=false, priority=0
2022-02-24 09:37:37.950 [main] INFO JobContainer - DataX jobContainer starts job.
2022-02-24 09:37:37.952 [main] INFO JobContainer - Set jobId = 0
Thu Feb 24 09:37:38 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2022-02-24 09:37:38.469 [job-0] INFO OriginalConfPretreatmentUtil - Available jdbcUrl:jdbc:mysql://10.114.12.193:3306/ddf70m?useUnicode=true&characterEncoding=utf8&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true.
2022-02-24 09:37:38.470 [job-0] WARN OriginalConfPretreatmentUtil - 您的配置文件中的列配置存在一定的风险. 因为您未配置读取数据库表的列,当您的表字段个数、类型有变动时,可能影响任务正确性甚至会运行出错。请检查您的配置并作出修改.
2022-02-24 09:37:38.480 [job-0] INFO DBUtil - this is ob1_0 jdbc url.
2022-02-24 09:37:38.480 [job-0] INFO DBUtil - this is ob1_0 jdbc url. user=obcluster:tpcc:transfer :url=jdbc:oceanbase://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf-8
2022-02-24 09:37:38.692 [job-0] INFO DbUtils - value for query [SHOW VARIABLES LIKE 'ob_compatibility_mode'] is [MYSQL]
2022-02-24 09:37:38.698 [job-0] INFO DBUtil - this is ob1_0 jdbc url.
2022-02-24 09:37:38.698 [job-0] INFO DBUtil - this is ob1_0 jdbc url. user=obcluster:tpcc:transfer :url=jdbc:oceanbase://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf-8&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true
2022-02-24 09:37:38.735 [job-0] INFO OriginalConfPretreatmentUtil - table:[x_a] all columns:[
ACCTNO,CLIENTNO,ACCTCLASS,LEDGERTYPE,ORGNO,LEGALPERSON,XID
].
2022-02-24 09:37:38.735 [job-0] WARN OriginalConfPretreatmentUtil - 您的配置文件中的列配置信息存在风险. 因为您配置的写入数据库表的列为*,当您的表字段个数、类型有变动时,可能影响任务正确性甚至会运行出错。请检查您的配置并作出修改.
2022-02-24 09:37:38.736 [job-0] INFO OriginalConfPretreatmentUtil - Write data [
INSERT INTO %s (ACCTNO,CLIENTNO,ACCTCLASS,LEDGERTYPE,ORGNO,LEGALPERSON,XID) VALUES(?,?,?,?,?,?,?)
], which jdbcUrl like:[||_dsc_ob10_dsc_||obcluster:tpcc||_dsc_ob10_dsc_||jdbc:mysql://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf-8&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true]
2022-02-24 09:37:38.737 [job-0] INFO JobContainer - jobContainer starts to do prepare ...
2022-02-24 09:37:38.737 [job-0] INFO JobContainer - DataX Reader.Job [mysqlreader] do prepare work .
2022-02-24 09:37:38.737 [job-0] INFO JobContainer - DataX Writer.Job [oceanbasev10writer] do prepare work .
2022-02-24 09:37:38.738 [job-0] INFO DBUtil - this is ob1_0 jdbc url.
2022-02-24 09:37:38.738 [job-0] INFO DBUtil - this is ob1_0 jdbc url. user=obcluster:tpcc:transfer :url=jdbc:oceanbase://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf-8&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true
2022-02-24 09:37:38.771 [job-0] INFO DbUtils - value for query [show variables like 'version'] is [3.1.2-OceanBase CE]
2022-02-24 09:37:38.771 [job-0] INFO JobContainer - jobContainer starts to do split ...
2022-02-24 09:37:38.771 [job-0] INFO JobContainer - Job set Channel-Number to 16 channels.
2022-02-24 09:37:38.775 [job-0] INFO JobContainer - DataX Reader.Job [mysqlreader] splits to [1] tasks.
2022-02-24 09:37:38.775 [job-0] INFO JobContainer - DataX Writer.Job [oceanbasev10writer] splits to [1] tasks.
2022-02-24 09:37:38.804 [job-0] INFO JobContainer - jobContainer starts to do schedule ...
2022-02-24 09:37:38.807 [job-0] INFO JobContainer - Scheduler starts [1] taskGroups.
2022-02-24 09:37:38.809 [job-0] INFO JobContainer - Running by standalone Mode.
2022-02-24 09:37:38.813 [taskGroup-0] INFO TaskGroupContainer - taskGroupId=[0] start [1] channels for [1] tasks.
2022-02-24 09:37:38.817 [taskGroup-0] INFO Channel - Channel set byte_speed_limit to -1, No bps activated.
2022-02-24 09:37:38.817 [taskGroup-0] INFO Channel - Channel set record_speed_limit to -1, No tps activated.
2022-02-24 09:37:38.824 [taskGroup-0] INFO TaskGroupContainer - taskGroup[0] taskId[0] attemptCount[1] is started
2022-02-24 09:37:38.826 [0-0-0-writer] INFO OceanBaseV10Writer$Task - tableNumber:1,writerTask Class:com.alibaba.datax.plugin.writer.oceanbasev10writer.task.ConcurrentTableWriterTask
2022-02-24 09:37:38.826 [0-0-0-reader] INFO CommonRdbmsReader$Task - Begin to read record by Sql: [select * from x_a 
] jdbcUrl:[jdbc:mysql://10.114.12.193:3306/ddf70m?useUnicode=true&characterEncoding=utf8&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true].
2022-02-24 09:37:38.827 [0-0-0-writer] INFO ConcurrentTableWriterTask - configure url is unavailable, use obclient for connections.
Thu Feb 24 09:37:38 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2022-02-24 09:37:38.835 [0-0-0-writer] INFO ConcurrentTableWriterTask - Disable partition calculation feature.
2022-02-24 09:37:38.842 [0-0-0-writer] INFO CommonRdbmsWriter$Task - write mode: insert
2022-02-24 09:37:38.842 [0-0-0-writer] INFO ConcurrentTableWriterTask - writeRecordSql :INSERT INTO x_a (ACCTNO,CLIENTNO,ACCTCLASS,LEDGERTYPE,ORGNO,LEGALPERSON,XID) VALUES(?,?,?,?,?,?,?)
2022-02-24 09:37:38.882 [0-0-0-writer] INFO DBUtil - this is ob1_0 jdbc url.
2022-02-24 09:37:38.883 [0-0-0-writer] INFO DBUtil - this is ob1_0 jdbc url. user=obcluster:tpcc:transfer :url=jdbc:oceanbase://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf-8&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true
2022-02-24 09:37:38.895 [0-0-0-writer] ERROR ConcurrentTableWriterTask - partCalculator is null
2022-02-24 09:37:38.895 [0-0-0-writer] INFO ConcurrentTableWriterTask - start 1 insert task.
2022-02-24 09:37:38.903 [0-0-0-writer] INFO DBUtil - this is ob1_0 jdbc url.
2022-02-24 09:37:38.904 [0-0-0-writer] INFO DBUtil - this is ob1_0 jdbc url. user=obcluster:tpcc:transfer :url=jdbc:oceanbase://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf-8&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true
2022-02-24 09:37:38.913 [0-0-0-writer] INFO ColumnMetaCache - fetch columnMeta of table x_a success
2022-02-24 09:37:39.008 [0-0-0-writer] INFO CommonRdbmsWriter$Task - isMemstoreFull=false
2022-02-24 09:37:42.837 [0-0-0-reader] INFO CommonRdbmsReader$Task - Finished read record by Sql: [select * from x_a 
] jdbcUrl:[jdbc:mysql://10.114.12.193:3306/ddf70m?useUnicode=true&characterEncoding=utf8&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true].
2022-02-24 09:37:43.044 [0-0-0-writer] INFO ConcurrentTableWriterTask - ConcurrentTableWriter has put all task in queue, queueSize = 1, total = 49, finished = 47
2022-02-24 09:37:43.229 [taskGroup-0] INFO TaskGroupContainer - taskGroup[0] taskId[0] is successed, used[4406]ms
2022-02-24 09:37:43.230 [taskGroup-0] INFO TaskGroupContainer - taskGroup[0] completed it's tasks.
2022-02-24 09:37:48.884 [job-0] INFO StandAloneJobContainerCommunicator - Total 100000 records, 4063507 bytes | Speed 396.83KB/s, 10000 records/s | Error 0 records, 0 bytes | All Task WaitWriterTime 3.632s | All Task WaitReaderTime 0.211s | Percentage 100.00%
2022-02-24 09:37:48.884 [job-0] INFO AbstractScheduler - Scheduler accomplished all tasks.
2022-02-24 09:37:48.885 [job-0] INFO JobContainer - DataX Writer.Job [oceanbasev10writer] do post work.
2022-02-24 09:37:48.885 [job-0] INFO JobContainer - DataX Reader.Job [mysqlreader] do post work.
2022-02-24 09:37:48.885 [job-0] INFO JobContainer - DataX jobId [0] completed successfully.
2022-02-24 09:37:48.886 [job-0] INFO HookInvoker - No hook invoked, because base dir not exists or is a file: /data/vlog/datax/hook
2022-02-24 09:37:48.886 [job-0] INFO JobContainer - 
     [total cpu info] => 
        averageCpu          | maxDeltaCpu          | minDeltaCpu          
        -1.00%            | -1.00%            | -1.00%
             

     [total gc info] => 
         NAME        | totalGCCount   | maxDeltaGCCount  | minDeltaGCCount  | totalGCTime    | maxDeltaGCTime  | minDeltaGCTime   
         PS MarkSweep    | 1         | 1         | 1         | 0.024s      | 0.024s      | 0.024s       
         PS Scavenge     | 2         | 2         | 2         | 0.020s      | 0.020s      | 0.020s       

2022-02-24 09:37:48.886 [job-0] INFO JobContainer - PerfTrace not enable!
2022-02-24 09:37:48.887 [job-0] INFO StandAloneJobContainerCommunicator - Total 100000 records, 4063507 bytes | Speed 396.83KB/s, 10000 records/s | Error 0 records, 0 bytes | All Task WaitWriterTime 3.632s | All Task WaitReaderTime 0.211s | Percentage 100.00%
2022-02-24 09:37:48.888 [job-0] INFO JobContainer - 
任务启动时刻          : 2022-02-24 09:37:37
任务结束时刻          : 2022-02-24 09:37:48
任务总计耗时          :        10s
任务平均流量          :     396.83KB/s
记录写入速度          :     10000rec/s
读出记录总数          :       100000
读写失败总数          :         0

数据校验

[admin@ocp ~]$ mysql -h10.144.2.106 -utransfer@tpcc -P2883 -ptransfer -c -A oceanbase
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 5.6.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [oceanbase]> use datax
Database changed
MySQL [datax]> show tables;
+-----------------+
| Tables_in_datax |
+-----------------+
| x_a      |
+-----------------+
1 row in set (0.00 sec)

MySQL [datax]> select count(1) from x_a;
+----------+
| count(1) |
+----------+
| 100000 |
+----------+
1 row in set (0.10 sec)

问题记录

mysqldump 报错问题

导出来的脚本有几个特征:

视图的定义也会在里面,但是会以注释 /!/。视图我们不关注,这部分内容可以删除。

会有一些特别的语法 OceanBase MYSQL 会不支持,但是不影响,需要替换掉其中部分。比如说变量 SQL_NOTES,DEFINER 语句等。

下面这个示例就是导出的脚本里有一个 MAX_ROWS= 的设置,这个是 MySQL 特有的,OceanBase MySQL 没有这个问题,也不需要这个设置,不支持这个语法,会报错。

Datax 报错问题

oceanbasev10writer配置jdbcUrl问题

"jdbcUrl":"||_dsc_ob10_dsc_||obcluster:tpcc||_dsc_ob10_dsc_||jdbc:mysql://10.144.2.106:2883/datax?useUnicode=true&characterEncoding=utf-8"
1
配置中第二个||后obcluster:tpcc必须是当前集群的集群名:租户名,否则会报错无法连接

集群名可以通过sys租户的root用户执行以下命令获取value:

MySQL [oceanbase]> show parameters like 'cluster';
+-------+----------+--------------+----------+---------+-----------+-----------+---------------------+----------+---------+---------+-------------------+
| zone | svr_type | svr_ip   | svr_port | name  | data_type | value  | info        | section | scope | source | edit_level    |
+-------+----------+--------------+----------+---------+-----------+-----------+---------------------+----------+---------+---------+-------------------+
| zone1 | observer | 10.144.2.107 |  2882 | cluster | NULL   | obcluster | Name of the cluster | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 10.144.2.109 |  2882 | cluster | NULL   | obcluster | Name of the cluster | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone1 | observer | 10.144.2.106 |  2882 | cluster | NULL   | obcluster | Name of the cluster | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 10.144.2.110 |  2882 | cluster | NULL   | obcluster | Name of the cluster | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 10.144.2.111 |  2882 | cluster | NULL   | obcluster | Name of the cluster | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 10.144.2.108 |  2882 | cluster | NULL   | obcluster | Name of the cluster | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+---------+-----------+-----------+---------------------+----------+---------+---------+-------------------+
6 rows in set (0.00 sec)

DataX 执行迁移报错ccess denied for user ‘obcluster:tpcc:transfer’@‘xxx.xxx.xxx.xxx’ (using password: YES)] 问题

在 DataX 中的 oceanbasev10writer 配置的 username ,就只能配置用户名,不需要像 obclient 连 OceanBase 一样,不能填写用户名:租户们#集群名

————————————————

附录:

练习题:

实践练习一(必选):OceanBase Docker 体验 

实践练习二(必选):手动部署 OceanBase 集群 

实践练习三(可选):使用OBD 部署一个 三副本OceanBase 集群 

实践练习四(必选):迁移 MySQL 数据到 OceanBase 集群 

实践练习五(可选):对 OceanBase 做性能测试 

实践练习六(必选):查看 OceanBase 执行计划 

还没交作业的小伙伴要抓紧啦!

可以免费带走 OBCP 考试券喔~~

方法一:完成四道必选练习

方法二:任意一道练习题 ➕ 结业考试超过80分

已经有很多同学抢先答题了,

加入钉钉群(群号3582 5151),和大家一起学习、交流~~

进群二维码:

金融行业实践:迁移 MySQL 数据到 OceanBase 集群-1

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论