| 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.
Retrieve and copy the index configuration of your database. 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:
- Use - gcloud firestore indexes composite listto retrieve a list of composite indexes:- gcloud firestore indexes composite list --database=DATABASE_ID- Replace DATABASE_ID with the ID of your database. 
- Use - gcloud firestore indexes fields listto retrieve a list of single-field (built-in) index exemptions.- 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 firestore backups listcommand to identify the backup to use for the restore operation and note the resource name. The resource name uses the following format:- projects/PROJECT_ID/locations/LOCATION/backups/BACKUP_ID
- Use the - gcloud firestore databases deletecommand to delete the existing database:- gcloud firestore databases delete --database='DATABASE_ID'- Replace DATABASE_ID with the database ID. 
- 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 firestore databases restorecommand:- gcloud firestore databases restore \ --source-backup=projects/PROJECT_ID/locations/LOCATION/backups/BACKUP_ID \ --destination-database='DATABASE_ID'- Replace DATABASE_ID with the database ID. 
What's next
- Learn more about backup schedules and restore operations
- Learn about configuring point-in-time recovery (PITR)