Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Recovering Cloud SQL Database Deleted 9 Days Ago with 7-Day Backup Retention

Hello Google Cloud Community,

I accidentally deleted a Cloud SQL database instance 9 days ago, and I had the automated backup retention period set to 7 days. I’m hoping to get assistance on whether there’s any way to recover the database or its data.

Here are the details:

Database Type: PostgreSQL 17

Region: eu-central1

Deletion Date: Approximately 9 days ago (April 2, 2025)

Backup Retention: Configured for 7 days

Additional Info: I haven’t found any on-demand backups in the Cloud SQL Backups tab, but I’m not sure if I missed something like retained backups or exports.

My questions:

  1. Is there any chance Google Cloud retains backups beyond the 7-day period for deleted instances (e.g., the 4-day grace period mentioned in some docs)?
  2. If recovery isn’t possible, are there other places I should check, like Cloud Storage for manual exports?
  3. Any advice on preventing this in the future would be appreciated.

Thank you in advance for your help! Please let me know if you need more details.

Best regards,

0 1 260
1 REPLY 1

Hi @xingl724,

To answer your questions, the standard behavior for Cloud SQL automated backups is that they are retained for the duration you configure, which in your case was 7 days. After an instance is deleted, these automated backups are typically deleted on a rolling basis, with the oldest being removed first. While there is no official documentation on Google providing a short grace period after an instance deletion, you may consider contacting Google Cloud Support. They may be able to assist further—especially if you have an Enhanced or Premium Support plan—and explore potential solutions for more complex recovery needs.

It's definitely worth checking Cloud Storage for any manual exports of your database that you might have performed in the past. Unlike automated backups managed by Cloud SQL's retention policies, manual exports you upload to Cloud Storage are independent and will persist until you explicitly delete them or the Cloud Storage bucket. If you had a routine of creating SQL dump files and storing them in a bucket, there's a chance your data might be recoverable from there. You would need to check your Cloud Storage buckets in the same project and region (eu-central1) to see if any such exports exist.

Based on Google Cloud’s documentation, recovery may still be possible through Point-in-Time Recovery (PITR)—but only if it was enabled before the data loss occurred. PITR lets you restore your database to a specific moment, which can be useful in cases of accidental deletion or corruption. However, if PITR wasn’t turned on, or if the backup retention window was too short, recovery options become very limited.

Here's some advice on preventing this situation in the future:

  • Increase Automated Backup Retention: Consider increasing your automated backup retention period to a longer duration (e.g., 14, 30, or even more days, depending on your needs and compliance requirements). This provides a larger window for recovery in case of accidental deletion or other issues. You can configure this setting when creating or editing your Cloud SQL instance.
  • Implement Regular Exports to Cloud Storage: As an additional layer of protection, set up a regular schedule for exporting your database to Cloud Storage. You can export SQL dump files, which can then be imported into a new or existing Cloud SQL instance. This provides a backup that is independent of your Cloud SQL instance's lifecycle. You can automate this process using tools like Cloud Functions or the gcloud sql export command.
  • Enable Deletion Protection: Cloud SQL offers a "deletion protection" setting for your instances. Enabling this prevents accidental deletion of the instance. You would need to explicitly disable this protection before you can delete the instance. This is a highly recommended setting for production environments.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.