gcloud alpha sql import bak - import data into a Cloud SQL instance from a BAK file
gcloud alpha sql import bak INSTANCE URI --database=DATABASE, -d DATABASE [--async] [--[no-]striped] [--cert-path=CERT_PATH --pvk-path=PVK_PATH (--prompt-for-pvk-password | --pvk-password=PVK_PASSWORD)] [GCLOUD_WIDE_FLAG ...]
(ALPHA) gcloud alpha sql import bak imports data into a Cloud SQL instance from a BAK backup file in Google Cloud Storage. You should use a full backup file with a single backup set.
For detailed help on importing data into Cloud SQL, refer to this guide: https://cloud.google.com/sql/docs/sqlserver/import-export/importing
To import data from the BAK file my-bucket/my-export.bak into the database my-database in the Cloud SQL instance my-instance, run:
$ gcloud alpha sql import bak my-instance \ gs://my-bucket/my-export.bak --database=my-database
To import data from the encrypted BAK file my-bucket/my-export.bak into the database my-database in the Cloud SQL instance my-instance, with the certificate gs://my-bucket/my-cert.crt, private key gs://my-bucket/my-key.key and prompting for the private key password, run:
$ gcloud alpha sql import bak my-instance \ gs://my-bucket/my-export.bak --database=my-database \ --cert-path=gs://my-bucket/my-cert.crt \ --pvk-path=gs://my-bucket/my-key.key --prompt-for-pvk-password
- INSTANCE
Cloud SQL instance ID.
- URI
Path to the BAK file file in Google Cloud Storage from which the import is made. The URI is in the form gs://bucketName/fileName.
- --database=DATABASE, -d DATABASE
A new database into which the import is made.
- --async
Return immediately, without waiting for the operation in progress to complete.
- --[no-]striped
Whether SQL Server import should be striped. Use --striped to enable and --no-striped to disable.
- Encryption info to support importing an encrypted .bak file
- --cert-path=CERT_PATH
Path to the encryption certificate file in Google Cloud Storage associated with the BAK file. The URI is in the form gs://bucketName/fileName.
This flag argument must be specified if any of the other arguments in this group are specified.
- --pvk-path=PVK_PATH
Path to the encryption private key file in Google Cloud Storage associated with the BAK file. The URI is in the form gs://bucketName/fileName.
This flag argument must be specified if any of the other arguments in this group are specified.
- Exactly one of these must be specified:
- --prompt-for-pvk-password
Prompt for the private key password associated with the BAK file with character echo disabled. The password is all typed characters up to but not including the RETURN or ENTER key.
- --pvk-password=PVK_PASSWORD
The private key password associated with the BAK file.
These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.
This command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist. These variants are also available:
$ gcloud sql import bak
$ gcloud beta sql import bak