__tencentdb__
in the source database to record the data comparison information during the migration task.__tencentdb__
system database in the source database will not be deleted after the migration task ends.__tencentdb__
system database uses a single-threaded connection wait mechanism and occupies a very small space, about 0.01%–0.1% of the storage space of the source database; for example, if the source database is 50 GB, __tencentdb__
will be about 5–50 MB. Therefore, it has almost no impact on the performance of the source database and will not preempt resources.CREATE USER 'migration account'@'%' IDENTIFIED BY 'migration password';GRANT RELOAD,LOCK TABLES,REPLICATION CLIENT,REPLICATION SLAVE,SHOW DATABASES,SHOW VIEW,PROCESS ON *.* TO 'migration account'@'%';// If the source database is a TencentDB for MariaDB database, you need to submit a ticket to authorize `RELOAD`; otherwise, you can authorize by referring to the sample code// If you select to migrate triggers and events, you need grant both the `TRIGGER` and `EVENT` permissions.GRANT ALL PRIVILEGES ON `__tencentdb__`.* TO 'migration account'@'%';GRANT SELECT ON *.* TO 'migration account';
CREATE USER 'migration account'@'%' IDENTIFIED BY 'migration password';GRANT RELOAD,LOCK TABLES,REPLICATION CLIENT,REPLICATION SLAVE,SHOW DATABASES,SHOW VIEW, PROCESS ON *.* TO 'migration account'@'%';// If the source database is a TencentDB for MariaDB database, you need to submit a ticket to authorize `RELOAD`; otherwise, you can authorize by referring to the sample code// If you select to migrate triggers and events, you need grant both the `TRIGGER` and `EVENT` permissions.GRANT ALL PRIVILEGES ON `__tencentdb__`.* TO 'migration account'@'%';GRANT SELECT ON `mysql`.* TO 'migration account'@'%';GRANT SELECT ON database to be migrated.* TO 'migration account';
SLAVE MONITOR
permission to run show slave status
.RELOAD
).SHOW CREATE TABLE
, which may cause differences of the synced DDL statements in the target database.SHOW CREATE TABLE
will still display the default value DEFAULT NULL
after the table is created.datetime
type in the source database is datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP
, SHOW CREATE TABLE
will display datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
after the table is created, and the DDL parsed by the target MySQL will be datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP
.CREATE OR REPLACE TABLE/PERIOD FOR/WITHOUT OVERLAPS
) may cause the migration task to report errors during full migration and will be ignored during incremental migration.PERIOD FOR/WITHOUT OVERLAPS
statement is executed before the migration task is started or during full migration (in the source database export and data import step), the migration task will fail; if it is executed during incremental sync, the target database will ignore it, and data cannot be synced to the target database.CREATE OR REPLACE TABLE
statement is executed during full migration, the migration task will fail; if it is executed during incremental sync, the target database will ignore it, and data cannot be synced to the target database.information_schema
, sys
, performance_schema
, __cdb_recycle_bin__
, __recycle_bin__
, __tencentdb__
, and mysql
cannot.user1
corresponding to DEFINER
([DEFINER = user1]
) in the source database is the same as the migration account user2
, and if not, DTS will change the SQL SECURITY
attribute of user1
in the target database from DEFINER
to INVOKER
([INVOKER = user1]
) after the migration, and set the DEFINER
in the target database to the migration account user2
([DEFINER = migration account user2]
). If the view definition in the source database is too complex, the task may fail.STATEMENT
format, the migration will fail.lower_case_tame_name
parameter (table name case sensitivity) of the source and target databases be the same. If the source database is TencentDB for MariaDB, as it allows modifying this parameter only during instance creation, you need to determine the case sensitivity rule when creating the source database and modify this parameter of the target database if the values are different during verification.ALTER VIEW
statement is not supported and will be skipped during migration.STATEMENT
format into the source database.__tencentdb__
during incremental migration.CREATE OR REPLACE TABLE/PERIOD FOR/WITHOUT OVERLAPS
are included, the migration task may report errors during full migration and will ignore them during incremental migration.Operation Type | Supported SQL Operation |
DML | INSERT, UPDATE, DELETE, REPLACE |
DDL | TABLE: CREATE TABLE, ALTER TABLE, DROP TABLE, TRUNCATE TABLE, RENAME TABLE VIEW: CREATE VIEW, DROP VIEW INDEX: CREATE INDEX, DROP INDEX DATABASE: CREATE DATABASE, ALTER DATABASE, DROP DATABASE CREATE TABLE table name AS SELECT is not supported. |
Type | Environment Requirement |
Requirements for the source database | The source and target databases can be connected. The server where the source database resides must have enough outbound bandwidth; otherwise, the migration speed will be affected. Requirements for instance parameters: The server_id parameter in the source database must be set manually and cannot be 0.row_format for the source databases/tables cannot be set to FIXED .The values of the lower_case_table_names variable in both the source and target databases must be the same.The connect_timeout variable in the source database must be greater than or equal to 10.We recommend you enable skip-name-resolve to reduce the possibility of connection timeout.Requirements for binlog parameters: The log_bin variable in the source database must be set to ON .The binlog_format variable in the source database must be set to ROW .The binlog_row_image variable in the source database must be set to FULL .On MariaDB 10.2 or later and Percona 5.6 or later, if the gtid_mode variable is not ON , an alarm will be triggered. We recommend you enable gtid_mode .You cannot set filter conditions with do_db and ignore_db .If the source instance is a replica database, the log_slave_updates variable must be set to ON .We recommend you retain the binlog of the source database for at least three days; otherwise, the task cannot be resumed from the checkpoint and will fail if it is suspended or interrupted for longer than the time set for binlog retention. Foreign key dependency: Foreign key dependency can be set to only one of the following two types: NO ACTION and RESTRICT .During partial table migration, tables with foreign key dependency must be migrated. The migration precision of DTS for data in FLOAT type is 38 digits, and for data in DOUBLE type is 308 digits. You should check whether this meets your requirements.The environment variable innodb_stats_on_metadata must be set to OFF . |
Requirements for the target database | The target database version must be later than or equal to the source database version. The size of the target database space must be at least 1.2 times that of the databases/tables to be migrated in the source database. Full data migration will execute INSERT operations concurrently, causing some tables in the target database to generate data fragments. Therefore, after full migration is completed, the size of the tables in the target database may be larger than that in the source database. The target database cannot have migration objects such as tables and views with the same name as those in the source database. The max_allowed_packet parameter of the target database must be set to 4 MB or above. |
Was this page helpful?