- NAME
-
- gcloud sql import bak - import data into a Cloud SQL instance from a BAK file
- SYNOPSIS
-
-
gcloud sql import bak
INSTANCE
[URI
]--database
=DATABASE
,-d
DATABASE
[--async
] [--bak-type
=BAK_TYPE
; default="FULL"] [--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
-
gcloud 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
- EXAMPLES
-
To import data from the BAK file
my-bucket/my-export.bak
into the databasemy-database
in the Cloud SQL instancemy-instance
, run:gcloud 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 databasemy-database
in the Cloud SQL instancemy-instance
, with the certificategs://my-bucket/my-cert.crt
, private keygs://my-bucket/my-key.key
and prompting for the private key password, run:gcloud 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
- 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
,-d
DATABASE
- 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_TYPE
must be one of:FULL
,DIFF
,TLOG
. --no-recovery
- Whether or not the SQL Server import is execueted 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 import only. 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
--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.
- 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 help
for details. - NOTES
-
These variants are also available:
gcloud alpha sql import bak
gcloud beta sql import bak
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-02-06 UTC.