MySQL HeatWave on AWS  /  ...  /  Exporting Data Using MySQL Shell

6.1.3 Exporting Data Using MySQL Shell

Use MySQL Shell to export data from a source MySQL Server to an Amazon S3 buket.

This task requires the following:

  • The MySQL Shell command-line utility. The commands in this task use the JS (JavaScript) execution mode of MySQL Shell. For installation instructions, refer to Installing MySQL Shell.

    Note:

    Exports created by MySQL Shell 8.0.27, or higher, cannot be imported by earlier versions of MySQL Shell. Using the latest version of MySQL Shell is always recommended.
  • You have run the dumpSchema command with the dryRun and ocimds parameters set to true:
    util.dumpSchemas("<Schema>", {s3bucketName: "<BucketName>", dryRun: true, ocimds: true})

    This performs a test run of the export checking for compatibility issues. The compatibility issues and remediation steps are listed in the output. See MySQL Shell Instance and Schema Dump Utilities.

To export a schema from a source MySQL Server:

  1. Start a MySQL Shell session and connect to the source MySQL Server:
    mysqlsh <user>@<HostNameOfSourceMySQLServer>

    For information about different MySQL Shell session and connection options, refer to the MySQL Shell User Guide.

  2. Export schema to an Amazon S3 bucket:
      util.dumpInstance("<Schema>",{s3bucketName: "<BucketName>", threads: <ThreadSize>, 
            compatibility: ["strip_restricted_grants", "strip_definers", "ignore_missing_pks"]})
    • <Schema>: The name of the schema being exported. For example, tpch.
    • <BucketName>: The Amazon S3 bucket to which the dump is to be written.
    • <ThreadSize>: The number of processing threads to use for this task. The default is 4. For best performance, it is recommended to set this parameter to twice the number of CPUs used by the target DB System.
    • compatibility: Specify compatibility modifiers that modify the exported data for compatibility with MySQL HeatWave on AWS. See MySQL Server Compatibility.
    See Options for S3-compatible Services.