Updated on 2022-09-06 GMT+08:00

Constructing Data Before the Migration

Before the migration, you need to construct some data types in the source database for data verification after the migration.

Prerequisites

You have obtained the IP address, port, username, and password of the source instance.

Procedure

  1. Use the database connection tool to connect to the IP address of the source database.
  2. Construct data in the source database based on the supported data types.

    1. Log in to the source database.
    2. Open a schema to be migrated.

      The schema used in this practice is db_test_info.

    3. Clear the previous table information in the db_test_info schema to ensure that data can be created successfully.

      drop table if exists db_test_info_001;

      db_test_info_001 is the name of the table created in this practice. Replace it as required.

    4. Create a data table.

      create table db_test_info_001(

      column19 TIMESTAMP ,

      column18 VARCHAR(256) ,

      column11 DATETIME ,

      column10 ENUM('a','b','c') ,

      column13 FLOAT(2,1) ,

      column12 YEAR ,

      column15 VARCHAR(64) not null,

      column14 DOUBLE(2,1) ,

      column17 INT ,

      column16 LONGTEXT ,

      column20 TIME ,

      column21 BIT(8) ,

      column22 LONGBLOB ,

      column23 MEDIUMINT ,

      column24 VARCHAR(20) ,

      column9 DECIMAL(2,1) ,

      column8 VARCHAR(1024) ,

      column5 SMALLINT ,

      column4 DATE ,

      column7 VARCHAR(32) ,

      column6 SET('hehe','xixi','haha') ,

      column1 char(1) ,

      column0 MEDIUMINT ,

      column3 BIGINT ,

      column2 TINYINT ,

      primary key(column19,column11,column17)

      );

    5. Insert records into the table.

      insert into db_test_info_001(column19,column11,column10,column1,column24,column15,column23,column0,column8) values('2019-07-24 14:08:58',now(),'A',(RAND()*10000000),(RAND()*10000000),'db_test_info_001',(RAND()*10000000),(RAND()*1000000),'a');

      insert into db_test_info_001(column19,column11,column17,column10,column1,column24,column15,column23,column0,column8) values(now(),now(),(RAND()*10000000),'A',(RAND()*10000000),(RAND()*10000000),'db_test_info_001',(RAND()*10000000),(RAND()*1000000),'a');

      insert into db_test_info_001(column19,column11,column17,column10,column1,column24,column15,column23,column0,column8) values(now(),now(),(RAND()*10000000),'A',(RAND()*10000000),(RAND()*10000000),'db_test_info_001',(RAND()*10000000),(RAND()*1000000),'a');

      insert into db_test_info_001(column19,column11,column17,column10,column1,column24,column15,column23,column0,column8) values(now(),now(),(RAND()*10000000),'A',(RAND()*10000000),(RAND()*10000000),'db_test_info_001',(RAND()*10000000),(RAND()*1000000),'a');

    6. Query the results.

      select * FROM db_test_info_001;