Import database files by using DMS

更新时间:
复制 MD 格式

You can use Data Management Service (DMS) to import SQL and CSV files from other servers or on-premises hosts into a web hosting database for data migration, data backup and recovery, and data analysis. This topic describes how to import an SQL file from an on-premises host into a MySQL database on a Linux-based web hosting instance.

Note

The procedure for importing SQL or CSV files from an on-premises host to a SQL Server database on a Windows-based web hosting instance is similar. The steps may differ slightly based on the UI.

Demonstration video

This video demonstrates how to import an SQL file by using DMS. The UI shown is for reference only.

Procedure

  1. Log on to the MySQL database on your Linux-based web hosting instance.

  2. On the SQLConsole page, under the Table tab, right-click your target table, for example, test, and click Import.

  3. In the Data Import dialog box, configure the parameters and then click Submit Request.

    The following table describes the parameters.

    Parameter

    Description

    Example

    Database

    The target database for the data import. The system selects this automatically.

    bdm721**_db@[bdm721**.my3w.com:3306]

    File encoding

    Select the encoding of the import file:

    • UTF-8

    • GBK

    • ISO-8859-1

    • Auto-detect

    Auto-detect

    Import mode

    Select an import mode. Two modes are supported:

    • Express Mode: Reads the file during the execution phase and directly runs the SQL statements in the target database. This mode is faster but less secure than Safe Mode.

    • Safe Mode: Parses the file during the pre-check phase and caches the SQL or CSV data. During the execution phase, the data is read from the cache and executed in the target database. This mode is more secure but slower than Express Mode.

    Express Mode

    File type

    The type of file to import. The following types are supported:

    • SQL script: In Secure Collaboration mode, only the INSERT and REPLACE commands are allowed by default.

    • CSV file: The delimiter in the file must be a comma (,).

    • Excel file: The Excel file can contain a header row with attribute names, or it can contain only data.

    SQL Script

    Attachment

    The file to import from your on-premises host. Click Upload File to select it.

    Note
    • SQL, CSV, TXT, XLSX, and ZIP files are supported.

    • The attachment cannot exceed 5 GB.

    qdm16****_sql.zip

  4. On the Data Import Ticket List page, confirm that the ticket has passed the pre-check and approval stages.

  5. In the Execute section, click Execute Change.

  6. In the Task Settings dialog box, select an Execution Policy and click Confirm Execution.

    Important

    We recommend performing this change during off-peak hours to avoid business interruptions.

    • Execute immediately: The default policy. The system executes the ticket immediately.

    • Scheduled execution: Select a start time for the task. The system automatically executes the task at the specified time.

Verify the results

After the task is complete, go to the SQL window for the target database. Enter SELECT * FROM t_user and click Execute (F8) to view the imported data.

Note

If the task fails, the status changes to Failed. Click Details in the Actions column to view the failure cause and solution.