gcloud beta spanner databases restore Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud beta spanner databases restore - restore a Cloud Spanner database
- SYNOPSIS
gcloud beta spanner databases restore(--destination-database=DESTINATION_DATABASE:--destination-instance=DESTINATION_INSTANCE)(--source-backup=SOURCE_BACKUP:--source-instance=SOURCE_INSTANCE)[--async][--encryption-type=ENCRYPTION_TYPE--kms-keys=[KMS_KEYS,…] | [--kms-key=KMS_KEY:--kms-keyring=KMS_KEYRING--kms-location=KMS_LOCATION--kms-project=KMS_PROJECT]][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(BETA)Restores from a backup to a new Cloud Spanner database.- EXAMPLES
- To restore a backup, run:
gcloudbetaspannerdatabasesrestore--source-backup=BACKUP_ID--source-instance=SOURCE_INSTANCE--destination-database=DATABASE--destination-instance=INSTANCE_NAMETo restore a backup using relative names, run:
gcloudbetaspannerdatabasesrestore--source-backup=projects/PROJECT_ID/instances/SOURCE_INSTANCE_ID/backups/BACKUP_ID--destination-database=projects/PROJECT_ID/instances/SOURCE_INSTANCE_ID/databases/DATABASE_ID - REQUIRED FLAGS
- Database resource - TEXT The arguments in this group can be used to specify theattributes of this resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.
To set the
projectattribute:- provide the argument
--destination-databaseon the command linewith a fully specified name; - provide the argument
--projecton the command line; - set the property
core/project.
This must be specified.
--destination-database=DESTINATION_DATABASE- ID of the database or fully qualified identifier for the database.
To set the
databaseattribute:- provide the argument
--destination-databaseon the command line.
This flag argument must be specified if any of the other arguments in this groupare specified.
- provide the argument
--destination-instance=DESTINATION_INSTANCE- The Cloud Spanner instance for the database.
To set the
instanceattribute:- provide the argument
--destination-databaseon the command linewith a fully specified name; - provide the argument
--destination-instanceon the command line; - set the property
spanner/instance.
- provide the argument
- provide the argument
- Backup resource - TEXT The arguments in this group can be used to specify theattributes of this resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.
To set the
projectattribute:- provide the argument
--source-backupon the command line with afully specified name; - provide the argument
--projecton the command line; - set the property
core/project.
This must be specified.
--source-backup=SOURCE_BACKUP- ID of the backup or fully qualified identifier for the backup.
To set the
backupattribute:- provide the argument
--source-backupon the command line.
This flag argument must be specified if any of the other arguments in this groupare specified.
- provide the argument
--source-instance=SOURCE_INSTANCE- The Cloud Spanner instance for the backup.
To set the
instanceattribute:- provide the argument
--source-backupon the command line with afully specified name; - provide the argument
--source-instanceon the command line; - set the property
spanner/instance.
- provide the argument
- provide the argument
- Database resource - TEXT The arguments in this group can be used to specify theattributes of this resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.
- OPTIONAL FLAGS
--async- Return immediately, without waiting for the operation in progress to complete.
--encryption-type=ENCRYPTION_TYPE- The encryption type of the restored database.
ENCRYPTION_TYPEmust be one of:customer-managed-encryption- Use the provided Cloud KMS key for encryption. If this option is selected,kms-key must be set.
google-default-encryption- Use Google default encryption.
use-config-default-or-backup-encryption- Use the default encryption configuration if one exists, otherwise use the sameencryption configuration as the backup.
- KMS key name group
At most one of these can be specified:
- Key resource - Cloud KMS key(s) to be used to restore the Cloud Spannerdatabase. This represents a Cloud resource. (NOTE) Some attributes are not givenarguments in this group but can be set in other ways.
To set the
kms-projectattribute:- provide the argument
--kms-keyson the command line with a fullyspecified name.
To set the
kms-locationattribute:- provide the argument
--kms-keyson the command line with a fullyspecified name.
To set the
kms-keyringattribute:- provide the argument
--kms-keyson the command line with a fullyspecified name.
--kms-keys=[KMS_KEYS,…]- IDs of the keys or fully qualified identifiers for the keys.
To set the
kms-keyattribute:- provide the argument
--kms-keyson the command line.
- provide the argument
- provide the argument
- Key resource - Cloud KMS key to be used to restore the Cloud Spanner database.The arguments in this group can be used to specify the attributes of thisresource.
--kms-key=KMS_KEY- ID of the key or fully qualified identifier for the key.
To set the
kms-keyattribute:- provide the argument
--kms-keyon the command line.
This flag argument must be specified if any of the other arguments in this groupare specified.
- provide the argument
--kms-keyring=KMS_KEYRING- KMS keyring id of the key.
To set the
kms-keyringattribute:- provide the argument
--kms-keyon the command line with a fullyspecified name; - provide the argument
--kms-keyringon the command line.
- provide the argument
--kms-location=KMS_LOCATION- Cloud location for the key.
To set the
kms-locationattribute:- provide the argument
--kms-keyon the command line with a fullyspecified name; - provide the argument
--kms-locationon the command line.
- provide the argument
--kms-project=KMS_PROJECT- Cloud project id for the key.
To set the
kms-projectattribute:- provide the argument
--kms-keyon the command line with a fullyspecified name; - provide the argument
--kms-projecton the command line.
- provide the argument
- Key resource - Cloud KMS key(s) to be used to restore the Cloud Spannerdatabase. This represents a Cloud resource. (NOTE) Some attributes are not givenarguments in this group but can be set in other ways.
- 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:
gcloudspannerdatabasesrestoregcloudalphaspannerdatabasesrestore
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 2025-05-07 UTC.