gcloud beta sql import bak Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud beta sql import bak - import data into a Cloud SQL instance from a BAK file
- SYNOPSIS
gcloud beta sql import bakINSTANCE[URI]--database=DATABASE,-dDATABASE[--async][--bak-type=BAK_TYPE; default="FULL"][--keep-encrypted][--no-recovery][--recovery-only][--stop-at=STOP_AT][--stop-at-mark=STOP_AT_MARK][--[no-]striped][--cert-path=CERT_PATH--pvk-path=PVK_PATH(--prompt-for-pvk-password|--pvk-password=PVK_PASSWORD)][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(BETA)gcloud beta sql import bak imports data into a Cloud SQLinstance from a BAK backup file in Google Cloud Storage. You should use a fullbackup 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
- EXAMPLES
- To import data from the BAK file
my-bucket/my-export.bakinto thedatabasemy-databasein the Cloud SQL instancemy-instance, run:gcloudbetasqlimportbakmy-instancegs://my-bucket/my-export.bak--database=my-databaseTo import data from the encrypted BAK file
my-bucket/my-export.bakinto the databasemy-databasein the Cloud SQL instancemy-instance, with the certificategs://my-bucket/my-cert.crt, private keygs://my-bucket/my-key.keyand prompting for the private keypassword, run:gcloudbetasqlimportbakmy-instancegs://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 - POSITIONAL ARGUMENTS
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.
- REQUIRED FLAGS
--database=DATABASE,-dDATABASE- A new database into which the import is made.
- OPTIONAL FLAGS
--async- Return immediately, without waiting for the operation in progress to complete.
--bak-type=BAK_TYPE; default="FULL"- Type of bak file that will be imported. Applicable to SQL Server only.
BAK_TYPEmust be one of:FULL,DIFF,TLOG. --keep-encrypted- Whether or not to decrypt the imported encrypted BAK file.
--no-recovery- Whether or not the SQL Server import is executed with NORECOVERY keyword.
--recovery-only- Whether or not the SQL Server import skip download and bring database online.
--stop-at=STOP_AT- Equivalent to SQL Server STOPAT keyword. Used in transaction log import only.Transaction log import stop at this timestamp. Format: YYYY-MM-DDTHH:MM:SS.
--stop-at-mark=STOP_AT_MARK- Equivalent to SQL Server STOPATMARK keyword. Used in transaction log importonly. Transaction log import stop at the given mark. To stop at given LSN, use--stop-at-mark=lsn:xxx.
--[no-]striped- Whether SQL Server import should be striped. Use
--stripedtoenable and--no-stripedto 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 withthe 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 groupare specified.
--pvk-path=PVK_PATH- Path to the encryption private key file in Google Cloud Storage associated withthe 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 groupare specified.
- Exactly one of these must be specified:
--prompt-for-pvk-password- Prompt for the private key password associated with the BAK file with characterecho disabled. The password is all typed characters up to but not including theRETURN or ENTER key.
--pvk-password=PVK_PASSWORD- The private key password associated with the BAK file.
- GCLOUD WIDE FLAGS
- 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 helpfor details. - NOTES
- This command is currently in beta and might change without notice. Thesevariants are also available:
gcloudsqlimportbakgcloudalphasqlimportbak
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-21 UTC.