Migrating Data to GaussDB(for MySQL) Using the Export and Import Functions of DAS
Scenarios
Data Admin Service (DAS) is a one-stop management platform that allows you to manage Huawei Cloud databases on a web console. It offers database development, O&M, and intelligent diagnosis, making it easy to use and maintain databases.
During data backup or migration, Data Admin Service (DAS) can help you export data to a local PC or OBS bucket, and import the data to the target data table. DAS allows you to export an entire database, some data tables, or SQL result sets.
Constraints
- Only one file that is no larger than 1 GB can be imported at a time.
- Only data files in .sql, .csv, or .xlsx format can be imported.
- If data files are exported as a .zip package, they cannot be directly imported. You need to extract the files first.
- Binary fields such as BINARY, VARBINARY, TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB cannot be imported.
- Data cannot be exported from or imported to cross-region OBS buckets.
Exporting Data
- Log in to the management console.
- Click in the upper left corner and select a region and project.
- Click in the upper left corner of the page and choose Databases > GaussDB(for MySQL).
- On the Instances page, locate an instance and click Log In in the Operation column.
- On the displayed DAS login page, enter the username and password and click Log In.
- On the top menu bar, choose Import and Export > Export.
- Export an entire database, some data tables, or SQL result sets.
- Export an entire database.
Method 1: Use the quick export function.
- Click Quick Export and select the database to be exported.
- In the displayed dialog box, select a storage path and click OK.
- DAS does not store any data. The exported data files are stored in the OBS bucket that you have created.
- Creating an OBS bucket is free, but you will be billed for storing data in the bucket.
Method 2: Create an export task.
- Click .
- In the displayed dialog box, configure task information.
Table 1 Parameter description Category
Parameter
Description
Basic Information
Database
Select the database to be exported and select Export all tables.
- You can also select Export from standby database as required. If this option is selected, DAS connects to your standby database to export data. This prevents the primary database from being affected by data export. However, if the standby database has a high replication delay, the exported data may not be the latest.
- Databases are classified into user databases and system databases. System databases cannot be exported. If system database data is required, deploy system database services in a user database, so that you can export the system database data from the user database.
Allowed Rows
Select the maximum number of rows in a single table.
File Type
Select SQL, CSV, or EXCEL.
Object to Export
Select Data, Structure, or Data and structure.
Charset
Select UTF8 or GBK.
Storage
Select an OBS bucket for storing data files.
Options
- Combine INSERT statements.
If you select this option, INSERT statements will be combined into files, with each file no greater than 5 MB.
- Generate a file for each table.
If you do not select this option, all data files will be exported as a .zip package, which cannot be directly imported. You need to extract the files first.
If you select this option, the data file (in .sql, .csv, or .xlsx format) of each table will be exported and can be directly imported again.
Remarks
-
Advanced Settings
You can configure advanced options as required.
- Click OK.
- Click Quick Export and select the database to be exported.
- Export some data tables.
- Click .
- In the displayed dialog box, configure task information.
Table 2 Parameter description Category
Parameter
Description
Basic Information
Database
Select the database to be exported and select the tables to be exported in the Tables area on the right.
You can also select Export from standby database as required. If this option is selected, DAS connects to your standby database to export data. This prevents the primary database from being affected by data export. However, if the standby database has a high replication delay, the exported data may not be the latest.
Allowed Rows
Select the maximum number of rows in a single table.
File Type
Select SQL, CSV, or EXCEL.
Object to Export
Select Data, Structure, or Data and structure.
Charset
Select UTF8 or GBK.
Storage
Select an OBS bucket for storing data files.
Options
- Combine INSERT statements.
If you select this option, INSERT statements will be combined into files, with each file no greater than 5 MB.
- Generate a file for each table.
If you do not select this option, all data files will be exported as a .zip package, which cannot be directly imported. You need to extract the files first.
If you select this option, the data file (in .sql, .csv, or .xlsx format) of each table will be exported and can be directly imported again.
Remarks
-
Advanced Settings
You can configure advanced options as required.
- Combine INSERT statements.
- Click OK.
- Export SQL result sets.
- Click .
- In the displayed dialog box, configure task information.
Table 3 Parameter description Category
Parameter
Description
Basic Information
Database
Select the database to be exported.
You can also select Export from standby database as required. If this option is selected, DAS connects to your standby database to export data. This prevents the primary database from being affected by data export. However, if the standby database has a high replication delay, the exported data may not be the latest.
Allowed Rows
Select the maximum number of rows in a single table.
File Type
Select SQL-Insert, CSV, or EXCEL.
Charset
Select UTF8 or GBK.
Storage
Select an OBS bucket for storing data files.
Options
- Combine INSERT statements.
If you select this option, INSERT statements will be combined into files, with each file no greater than 5 MB.
- Generate one file for each result.
If you do not select this option, all data files will be exported as a .zip package, which cannot be directly imported. You need to extract the files first.
If you select this option, the data file (in .sql, .csv, or .xlsx format) of each result set will be exported and can be directly imported again.
SQL to Execute
Enter an SQL statement.
To export multiple SQL result sets at a time, enter multiple SQL statements, with each on a separate line and ending with a semicolon (;). After the export task is complete, SQL files are generated. One SQL statement corresponds to one file.
Remarks
-
Advanced Settings
You can configure advanced options as required.
- Combine INSERT statements.
- Click OK.
Importing Data
- Log in to the management console.
- Click in the upper left corner and select a region and project.
- Click in the upper left corner of the page, choose .
- On the Instances page, locate an instance and click Log In in the Operation column.
- On the displayed DAS login page, enter the username and password and click Log In.
- On the top menu bar, choose Import and Export > Import.
- Click Create Task.
- In the displayed dialog box, configure task information.
Table 4 Parameter description Parameter
Description
Import Type
Set this parameter based on the type of an exported file. Currently, only SQL and CVS files are supported.
File Source
Import a file from your local PC or an OBS bucket.
- Upload file
If you select Upload file for File Source, you need to set Attachment Storage and upload the required file.
To keep your data secure, provide your own OBS bucket to store the attachments you upload. In this way, DAS automatically connects to your OBS bucket for in-memory reading.
Creating an OBS bucket is free, but you will be billed for storing data in the bucket.
- Choose from OBS
If you select Choose from OBS for File Source, you need to select a file from the bucket.
The file uploaded from an OBS bucket will not be deleted upon an import success.
Database
Select the destination database.
Charset
Select UTF8, GBK, or Auto Detect.
Options
- Ignore errors, skip the step when the SQL statement fails to be executed.
If you select this option, the system will skip any errors detected when SQL statements are being executed.
- Delete the uploaded file upon an import success.
If you select this option, the file you uploaded will be automatically deleted from the OBS bucket after being imported to the destination database. This option is only available to the files uploaded from your local PC.
Remarks
-
- Upload file
- Click Create.
- In the displayed dialog box, confirm the information and click OK.
- After the data is imported successfully, log in to the destination database to query the imported data.
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.
For any further questions, feel free to contact us through the chatbot.
Chatbot