Help Center/
Distributed Database Middleware/
User Guide/
Data Migration/
Scenario 4: Exporting Data from a DDM Instance
Updated on 2024-04-01 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:
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}
- You can connect to the target RDS for MySQL instance to export data of unsharded tables to improve export efficiency.
- For details about mysqldump5.7, visit https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html.
Parent topic: Data Migration
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot