Stay organized with collections
Save and categorize content based on your preferences.
Relevant to Cloud Firestore Standard edition and Cloud Firestore Enterprise edition.
This page describes how to restore data in a backup to a database with the same
name as the source database of the backup.
Before you read this page, you should be familiar with
Back up and restore data.
In-place restore
An in-place restore lets you restore a database from a backup to the
source database that created the backup while the original database still
exists. An in-place restore helps you avoid rerouting traffic
or creating a database with a different name.
A restore operation must use a destination database that
doesn't already exist. You can, however, simulate an in-place restore by deleting
the source database and then restoring from a backup to a new database with the
same name as the source database.
Perform an in-place restore
To perform an in-place restore, follow these steps:
Identify the backup to use for the restore operation.
Delete the existing database.
Use the backup and the database ID of the deleted database to complete the restore operation.
Before you begin
We recommend completing the following steps before starting the in-place restore
process:
If you need to recover the deleted database,
import the data from export operation.
To recover the deleted database to the same database ID, you must wait until
any running restore operations complete and then:
Delete the existing database with the database ID and wait at least 5 minutes
Create a new database with the database ID
Start an import operation
Retrieve and copy the index configuration of your database. Export operations
do not capture index definitions. Use the index configuration to re-create
indexes after you complete the in-place restore operation. Use the following commands
to retrieve the index configuration of your database:
gcloud firestore indexes fields list --database=DATABASE_ID
Perform an in-place restore
Complete the following steps to perform an in-place restore operation. This process
requires downtime between the moment you delete the database and when the
restore operation completes.
Once a restore operation begins, you cannot cancel the operation and must wait
until the operation completes. The restore operation immediately occupies the
database ID used in the operation.
Use the gcloud alpha firestore backups list command to identify the backup to use
for the restore operation and note the resource name. The resource name uses
the following format:
Wait at least 5 minutes after you delete the database for the database ID
to become available again. Initiate a restore operation using the
gcloud alpha firestore databases restore
command:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["\u003cbr /\u003e\n\n\n|----------------------------------------------------------------------------------------|\n| *Relevant to Cloud Firestore Standard edition and Cloud Firestore Enterprise edition.* |\n\n\u003cbr /\u003e\n\nThis page describes how to restore data in a backup to a database with the same\nname as the source database of the backup.\nBefore you read this page, you should be familiar with\n[Back up and restore data](/docs/firestore/enterprise/backups).\n\nIn-place restore\n\nAn in-place restore lets you restore a database from a backup to the\nsource database that created the backup while the original database still\nexists. An in-place restore helps you avoid rerouting traffic\nor creating a database with a different name.\n| **Warning:** Once you start the in-place restore process, the original database is permanently lost, and you can't undo this operation.\n\nA restore operation must use a destination database that\ndoesn't already exist. You can, however, simulate an in-place restore by deleting\nthe source database and then restoring from a backup to a new database with the\nsame name as the source database.\n\nPerform an in-place restore\n\nTo perform an in-place restore, follow these steps:\n\n1. Identify the backup to use for the restore operation.\n2. Delete the existing database.\n3. Use the backup and the database ID of the deleted database to complete the restore operation.\n\n| **Caution:** If your app uses a Cloud Firestore in Native mode client library and your clients use an offline cache, an in-place restore might flush your writes to the restored database instead of discarding the writes. This situation can occur if the client that is connected to the deleted database goes offline and, while offline, the cache accumulates writes at the time when you perform an in-place restore.\n\nBefore you begin\n\nWe recommend completing the following steps before starting the in-place restore\nprocess:\n\n1. [Export the data](/docs/firestore/enterprise/export-import#export_data) in the database you will delete.\n\n If you need to recover the deleted database,\n [import](/docs/firestore/enterprise/export-import#import_data) the data from export operation.\n To recover the deleted database to the same database ID, you must wait until\n any running restore operations complete and then:\n 1. Delete the existing database with the database ID and wait at least 5 minutes\n 2. Create a new database with the database ID\n 3. Start an import operation\n2. Retrieve and copy the index configuration of your database. Export operations\n do not capture index definitions. Use the index configuration to re-create\n indexes after you complete the in-place restore operation. Use the following commands\n to retrieve the index configuration of your database:\n\n - Use [`gcloud firestore indexes composite list`](https://cloud.google.com/sdk/gcloud/reference/firestore/indexes/composite/list)\n to retrieve a list of composite indexes:\n\n gcloud firestore indexes composite list --database=\u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e with the ID of your database.\n - Use [`gcloud firestore indexes fields list`](https://cloud.google.com/sdk/gcloud/reference/firestore/indexes/fields/list)\n to retrieve a list of single-field (built-in) index exemptions.\n\n gcloud firestore indexes fields list --database=\u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e\n\nPerform an in-place restore\n\nComplete the following steps to perform an in-place restore operation. This process\nrequires downtime between the moment you delete the database and when the\nrestore operation completes.\n\nOnce a restore operation begins, you cannot cancel the operation and must wait\nuntil the operation completes. The restore operation immediately occupies the\ndatabase ID used in the operation.\n\n1. Use the [`gcloud alpha firestore backups list`](https://cloud.google.com/sdk/gcloud/reference/alpha/firestore/backups/list) command to identify the backup to use\n for the restore operation and note the resource name. The resource name uses\n the following format:\n\n projects/PROJECT_ID/locations/LOCATION/backups/BACKUP_ID\n\n2. Use the `gcloud firestore databases delete` command to delete the existing\n database:\n\n gcloud firestore databases delete --database='\u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e'\n\n Replace \u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e with the database ID.\n3. Wait at least 5 minutes after you delete the database for the database ID\n to become available again. Initiate a restore operation using the\n [`gcloud alpha firestore databases restore`](https://cloud.google.com/sdk/gcloud/reference/alpha/firestore/databases/restore)\n command:\n\n gcloud alpha firestore databases restore \\\n --source-backup=projects/PROJECT_ID/locations/LOCATION/backups/BACKUP_ID \\\n --destination-database='\u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e'\n\n Replace \u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e with the database ID.\n\nWhat's next\n\n- [Learn more about backup schedules and restore operations](/docs/firestore/enterprise/backups)\n- [Learn about configuring point-in-time recovery (PITR)](/docs/firestore/enterprise/pitr)"]]