Help Center> Distributed Database Middleware> User Guide> Data Migration> Scenario 4: Exporting Data from a DDM Instance
Updated on 2023-10-09 GMT+08:00

Scenario 4: Exporting Data from a DDM Instance

Scenarios

Export data from a DDM instance to a SQL text file.

Precautions

  • Export table data during off-peak hours. This is because performance of the DDM instance and its associated RDS for MySQL instances may be affected during the export.
  • Use mysqldump to dump database data on a large disk to ensure that there is enough disk space.
  • Run the following command in Linux to ensure that mysqldump still works when a session times out:

    nohup {mysqldump CLI} &

Export Table Structure

If the DDM version is 2.4.X or later, run the following command to export table structures:

  • If the MySQL client version is 5.6 or 5.7, run the following command:
    mysqldump -h {DDM_ADDRESS} -P {DDM_PORT} -u {DDM_USER} -p --no-data --skip-lock-tables --default-auth=mysql_native_password --skip-tz-utc {DB_NAME} {TABLE_NAME} > {mysql_table_schema_ddm.sql}
  • If the MySQL client version is 8.0, run the following command:
    mysqldump -h {DDM_ADDRESS} -P {DDM_PORT} -u {DDM_USER} -p --no-data --skip-lock-tables --default-auth=mysql_native_password --column-statistics=0 --skip-tz-utc {DB_NAME} {TABLE_NAME} > {mysql_table_schema_ddm.sql}

Export Table Data

If the DDM version is 2.4.X or later, run the following command to export table data:

mysqldump -h {DDM_ADDRESS} -P {DDM_PORT} -u {DDM_USER} -p --skip-lock-tables --add-locks=false --hex-blob --complete-insert --set-gtid-purged=OFF --quick --no-create-info --skip-comments [--where=""] --skip-tz-utc{DB_NAME} {TABLE_NAME} > {mysql_table_data_ddm.sql}