1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-08 10:35:03 +00:00
gcloud-help/gcloud/alpha/sql/import/bak
2026-02-11 11:28:25 +00:00

129 lines
4.9 KiB
Text

NAME
gcloud alpha sql import bak - import data into a Cloud SQL instance from a
BAK file
SYNOPSIS
gcloud alpha sql import bak INSTANCE [URI] --database=DATABASE, -d DATABASE
[--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
(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
EXAMPLES
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
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.
--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
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
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