Cloud SQL backups overview
Preview —Enhanced backups
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. You can process personal data for this feature as outlined in theCloud Data Processing Addendum, subject to the obligations and restrictions described in the agreement under which you access Google Cloud. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
Cloud SQL lets you back up your instances on-demand, or automaticallyusing a backup schedule. Backup configurations available for your instancedepend on your instance'sbackup option. Cloud SQLbackups are incremental and help you restore lost data to your Cloud SQLinstance. Backups are also encrypted by default using Google-managed orCustomer-Managed Encryption keys (CMEK). With backups, you can:
- Restore your instance to a previous state if your instance is facing anissue.
- Set up Disaster Recovery (DR) by creating a new instance using a backupin a different region or zone.
- Create multiple instances using backups to help in development, testing,and migration.
You can retain these backups by defining your instance's backup retention settings.Retention settings can differ based on your instance'sCloud SQL edition andbackup option.Additionally, you can also retain backups after your instance is deleted toallow you to restore the instance after deletion.
Note: Restoring from a backup doesn't retain the IP address ofthe deleted instance. To restore your instance, including theIP address in the case of accidental deletion, Cloud SQLretains the backups of deleted instances for four days. To recover a deletedinstance to the exact state at the time of deletion, contactGoogle Cloud Customer Care within four days.Backup options
Cloud SQL offers two backup service options to manage your instance's backups:
- Enhanced backups:backups are managed and stored in a centralized backup management projectthat leverages the Backup and DR Service, and provides enforced retention,granular scheduling, and monitoring.
- Standard backups:backups are created, managed, and stored in the same project as yourCloud SQL instances. This is the existing Cloud SQLbackup offering and is now called standard backups.
You must select a backup option for each instance. For more information abouteach backup option and its features, seeChoose your backup option.
Note: If your instance was created before theenhanced backups launch,then your instance is using the standard backups option. To upgrade yourinstance to the enhanced backups option, seeEnable enhanced backups.For new instances, you'll need to select a backup option when youcreate the instance.Backup request types
You can take on-demand, automated, or final backups for yourCloud SQL instances. The configuration available for thesebackups depend on your instance's selectedbackup option.
On-demand backups
On-demand backups are backups that can becreated at any time.These are useful if you are about to perform a risky operation on your database,or if you need a backup and don't want to wait for the backup window. You cancreate on-demand backups for any instance, whether the instance has automaticbackups enabled or not.
Automated backups
Automated backups are taken on a scheduled cadence, such as hourly, daily,weekly, or monthly, while your instance is running. The scheduled cadencedepends on thebackup option youchoose for your instance and the cadence you define in the backup configurationfor the selected backup option. The backup starts during the backup window.
One additional automated backup is taken after your instance is stopped tosafeguard all changes prior to the instance stopping. Automated backup retentiondepends on the configured retention policy in the chosen backup option for yourinstance. It's recommended that you schedule your backups when your instance hasless activity, if possible.
It's also recommended that you don't manually delete any automated backupsbecause they're needed to supportpoint-in-time recovery.
To configure your instance's automated backups, seeConfigure automated backups.
Final backup
Final backups let you take a backup of your Cloud SQL instance beforeyou delete the instance. This is useful to retain the instance data after youdelete the instance. You can use the final backup to either create a newinstance, or to restore to an existing instance. For more information aboutaccessing and viewing details about your final backup, seeView a list of final backups.
You can set your instance to take a final backup automatically when youdelete your instance byenabling the final backupinstance setting for your instance. You can also set thefinal backup retention periodwhen you enable final backups for your instance. If you don't enablefinal backups for your instance, then you can also take a finalbackup when youdelete your instance.Final backups are only available for primary instances and aren't supportedfor replicas. You can also set anCloud SQL custom organization policyto take a final back at instance deletion for all instances in your organizationand set a standard retention period. For more information, seeExample custom organization policies for common use cases.
By default, Cloud SQL retains the final backup for 30 days.However, you can customize how long Cloud SQL retains the backup.This can range from 1 day to 365 days for standard backups,or 1 day to 99 years for enhanced backups.You can thenrestore the instance from the backupas long as it's available. Final backups are charged similar to other backupsfor the number of days retained.
For more information about how to enable final backups for your newor existing instances using the standard backups option, seeConfigure final backups.For enhanced backups, final backups are managed by the associatedbackup plan.
To manage a final backup after your instance is deleted, seeManage backups for deleted instances.
Backup retention
Backup retention is defined by the backup request type and the backup option youselect for your instance. For automated backups, retention can range from7 days to 99 years,depending on your instance's backup option. For on-demand backups,backups are stored indefinitely until the backup is deleted. For moreinformation about backup retention related to your instance'sbackup option, seeChoose your backup option.
Retain backups after instance deletion
Retained backups are backups that are retained by Cloud SQL after aninstance is deleted. These backups consist of on-demand backups andautomated backups created when the instance was live. When you delete aninstance, these backups become independent of your instance and are storedat the project level. Retained backups are different fromfinal backups,which are the last backups taken at time of instance deletion.
You can update the description of these backups to makeit easier to manage them in your Google Cloud project. Retained backups can berestored to a new or existing Cloud SQL instanceat any time.
For these backups, the retention period is defined by the type of backup it isand can't be changed after the instance is deleted. For standard backups,on-demand backups are kept indefinitely untileither the backup is manually deleted, or the project containing the backup isdeleted. For enhanced backups,on-demand backupsare kept based on the selected retention rule.Automated backups are deleted on a rolling basis, onebackup per day, after the instance is deleted. The rolling period is definedbased on the retention settings of the instance prior to deletion, which canrange from 1 day to 99 years, depending on your instance's selectedbackup option. Forexample, if your instance's automated backup retention setting was set to 7,then the latest automated backup is deleted 7 days after the instance deletion.
Retained backups can be deleted manually at any time. However, when you deletea retained backup, the deleted backup can't be recovered.
For standard backups, since instance names can be used after an instance isdeleted in Cloud SQL, retained backups are stored in yourGoogle Cloud project with a field calledinstance_deletion_time. Thisfield lets you identify whether a particular backup belongs to a live ordeleted instance. You can also update the description of a backup to make iteasier to manage them.
For more information about how to enable retained backups for your newor existing instances using the standard backups option, seeConfigure retained backups.For enhanced backups, retained backups are managed by the associatedbackup plan.
To manage a retained backup after your instance is deleted, seeManage backups for deleted instances.
Recovery backups
Cloud SQL attempts to retain at least one last daily backup of everyactive instance, if there are no good backups available as part of the automatedbackup policy. You can use this backup for recovery purposes by contactingGoogle Cloud Customer Care.
Backup and data integrity checks
Cloud SQL automatically performs background database integrity checksto identify any potential data integrity issues. The integrity check is done asan offline process by restoring a sampling ofcustomer initiated backups orrecovery backups.
Backups for replicas
Backups aren't available for replica instances. Since replica instances arecopies of primary instances, backups are maintained with the primary instance.If a replica instance is promoted to a standalone instance due to a failoveror switchover, then the instance is enabled for backups and would require itsown backup configuration. Promoted replicas don't inherhit the primaryinstance backup configurations and can't access the primary instance'sbackups.
Backups versus exports
Backups are managed by Cloud SQL according to retention policies, and arestored separately from the Cloud SQL instance. Cloud SQL backupsdiffer from anexport uploadedto Cloud Storage, where you manage the lifecycle. Backups encompass theentire disk of the instance. Exports can select specific contents.
Backup and restore operations can't be used to upgrade a database to a laterversion. You can only restore from a backup to an instance with the samedatabase version as when the backup was taken.
To upgrade to a later version, perform anin-place major version upgrade,orexport and then import yourdatabase to a new Cloud SQL instance.Backup size
All Cloud SQL backups, except the first one, are incremental. Theycontain only data that changed after the previous backup was taken. Your oldestbackup is a similar size to your database, but the sizes of subsequent backupsdepend on the rate of change of your data. When the oldest backup is deleted,the size of the next oldest backup increases to become a full backup and isadjusted to capture the difference between the backups. Each incrementalbackup following is also updated to match the new full backup.
You cancheck the size of an individual backup.The backup size represents the billable size for each backup.
Troubleshooting
| Issue | Troubleshooting |
|---|---|
| You can't see the current operation's status. | The Google Cloud console reports only success or failure when the operation is done. It isn't designed to show warnings or other updates. Run the |
| You want to find out who issued an on-demand backup operation. | The user interface doesn't show the user who started an operation. Look in thelogs and filter by text to find the user. You may need to use audit logs for private information. Relevant log files include:
|
| After an instance is deleted, you can't take a backup of the instance. | If you delete an instance without taking afinal backup of the data, then no data recovery is possible. However, if you restore the instance, then Cloud SQL also restores the backups. For more information on recovering a deleted instance, seeRetain backups after instance deletion. If you have done an export operation, create a new instance and then do an import operation to recreate the database. Exports are written to Cloud Storage and imports are read from there. Note:Cloud SQL recommends that you take a final backup of your data before you delete the instance. This way, you can recreate any instances that you delete accidentally without contactingCloud Customer Care. |
| An automated backup is stuck for many hours and can't be canceled. | Backups can take a long time depending on the database size. If you really need to cancel the operation, you can ask customer support to |
| A restore operation can fail when one or more users referenced in the SQL dump file don't exist. | Before restoring a SQL dump, all the database users who own objects or were granted permissions on objects in the dumped database must exist in the target database. If they don't, the restore operation fails to recreate the objects with the original ownership or permissions. Create the database users before restoring the SQL dump. |
| You want to increase the number of days that you can keep automatic backups from seven to 30 days, or longer. | You can configure the number of automated backups to retain, but you can't retain fewer than the default (seven). Automated backups get pruned regularly based on the retention value configured. Unfortunately, this means that the currently visible backups are the only automated backups you can restore from. To keep backups indefinitely, you cancreate an on-demand backup, as they are not deleted in the same way as automated backups. On-demand backups remain indefinitely. That is, they remain until they're deleted or the instance they belong to is deleted. Because that type of backup is not deleted automatically, it can affect billing. |
| An automated backup failed and you didn't receive an email notification. | To have Cloud SQL notify you of the backup's status,configure a log-based alert. |
| You're unable to restore your instance using theTransact-SQL RESTORE command or theSQL Server Management Studio (SSMS). | Cloud SQL does not support restoring instances through SSMS. To restore your instance, run thegcloud sql import command. |
| You can't see the log backup history. | Log backup history is only retained for 60 days inmsdb database backup history tables. |
| Unable to delete an instance when you elect to take a final backup at instance deletion. | When you delete an instance, you're required to confirm whether you want to take a final backup for your instance prior to deleting it. If you enabled final backup using thefinal-backup instance setting, then the selection you make when you delete your instance must match the final backup instance configuration you set when you enabled final backup for your instance. To mitigate this issue, do one of the following:
|
| Unable to create a replica instance after successfully creating a primary instance with the final backup setting. | If you create a new instance with the final backup instance setting enabled, then you must update the final backup organization policy to apply the backup configurations to the primary instance only. Final backups aren't supported for replica instances. For more information, seeCloud SQL organization policies. |
What's next
- Choose a backup optionfor your Cloud SQL instance.
- Learn more aboutrestoring.
- Restore from a backup
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-11-24 UTC.