[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# About restoring an instance\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/sql/docs/postgres/backup-recovery/restore \"View this page for the PostgreSQL database engine\") \\| [SQL Server](/sql/docs/sqlserver/backup-recovery/restore \"View this page for the SQL Server database engine\")\n\n\u003cbr /\u003e\n\nThis page provides information to review before restoring an instance\nfrom a backup or performing a point-in-time recovery (PITR).\n| **Note:** This page contains features related to Cloud SQL editions. For more information about Cloud SQL editions, see [Introduction to Cloud SQL editions](/sql/docs/mysql/editions-intro).\n\nWhat happens during a restore?\n------------------------------\n\nFor Cloud SQL Enterprise edition and Cloud SQL Enterprise Plus edition, you can restore an instance from a backup. You can also restore backups across instances of different editions.\n\nWhen you restore an instance, the following data from the primary instance\nare restored to the new instance:\n\n- Databases\n- Users\n\n| **Note:** The flags from the primary instance are not restored. Any flags previously set on the target instance are retained after the restore.\n\nThe restore operation causes the instance to restart.\n\nPoint-in-time recovery (PITR)\n-----------------------------\n\nPoint-in-time recovery (PITR) helps you recover an instance to a specific point in\ntime. For example, if an error causes a loss of data, you can recover a database\nto its state before the error occurred.\n\nPITR always creates a new instance; you can't perform a\nPITR to an existing instance. The new instance inherits the\nsettings of the source instance, similar to how\n[clone creation](/sql/docs/mysql/clone-instance) works.\n\n\u003cbr /\u003e\n\nWhen you create a Cloud SQL instance in the Google Cloud console, PITR is enabled by default.\n\nPITR uses [binary logging](/sql/docs/mysql/backup-recovery/pitr#enablingpitr)\nto archive logs. By default, PITR is enabled for Cloud SQL Enterprise Plus edition\ninstances.\nWhen you restore a backup on a Cloud SQL instance before enabling PITR, you lose the archived logs that let you use PITR. If the size of your binary logs on disk is causing performance issues for your instance, then deactivate PITR and re-enable it. This action ensures that new logs are stored in Cloud Storage instead of on disk.\n\n\u003cbr /\u003e\n\n| **Caution:** If you deactivate and re-enable PITR, then any existing logs are deleted, and you won't be able to perform PITR earlier than the time that you re-enabled it. Enabling PITR requires restarting the database.\n\nFor step-by-step instructions for performing PITR, see [Use point-in-time recovery (PITR)](/sql/docs/mysql/backup-recovery/pitr).\n\n### Restore an unavailable instance\n\nYou can use PITR to restore a Cloud SQL instance that isn't available. PITR typically offers a recovery point objective (RPO) of five minutes or less.\n\nIf the instance is unavailable, then you can use the API to [check for the latest time](/sql/docs/mysql/backup-recovery/pitr#get-the-latest-recovery-time) to which you can restore the instance and perform the recovery to that time. If the zone in which the instance is configured isn't accessible, then you can [restore the instance to a different primary or secondary zone](/sql/docs/mysql/backup-recovery/pitr#perform-PITR-unavailable-instance) by providing values for the preferred zones.\n\nSuppose a Cloud SQL instance becomes unavailable at 4 PM EST. If the latest recovery time is at 3:55 PM EST, then you can recover the instance up to this time.\n\nGeneral tips about performing a restore\n---------------------------------------\n\nWhen you restore an instance from a backup, whether to the same instance or to\na different instance, keep in mind the following items:\n\n- The restore operation overwrites all data on the target instance.\n- The target instance is unavailable for connections during the restore operation; existing connections are lost.\n- If you are restoring to an instance with read replicas, you must delete all replicas and recreate them after the restore operation completes.\n- The restore operation restarts the instance.\n\nFor step-by-step instructions for performing a restore, see:\n\n- [Restoring an instance](/sql/docs/mysql/backup-recovery/restoring)\n\nTips and requirements for restoring to a different instance\n-----------------------------------------------------------\n\nWhen you are restoring a backup to a different instance, keep in mind the\nfollowing restrictions and best practices:\n\n- The target instance must have the same database version as the instance from which the backup was taken.\n\n\n If you want to upgrade the database version for your instance, follow the steps in\n [Upgrade the database major version in-place](/sql/docs/mysql/upgrade-major-db-version-inplace).\n- Cloud SQL always sets the storage capacity of the target instance to the\n maximum value of the size of both the configured disk and the backup disk. The\n backup disk is the size of the disk when the backup is taken.\n\n- The storage capacity of the target instance must be at least as large as the\n *capacity* of the instance being backed up. The amount of storage used does\n not matter. You can see the storage capacity of the instance in the console\n [Cloud SQL\n instances page](https://console.cloud.google.com/sql/instances).\n\n- The target instance must be in the `RUNNABLE` state.\n\n- The target instance can use a different number of cores and amounts of memory\n than the instance from which the backup was taken.\n\n- The target instance can be in a different region from the source instance.\n\n- During an outage, you can still retrieve a list of backups in a particular\n project. See [Viewing backups during an outage](/sql/docs/mysql/backup-recovery/backing-up#backuplist).\n\nRestore rate limitations\n------------------------\n\nYou are allowed a maximum of three restore operations every 30 minutes per\ninstance per region per project. If a restore operation fails, it does not count\ntowards this quota. If you reach the limit, the operation fails with an error\nmessage that tells you when you can run the operation again.\n\nLet's take a look at how Cloud SQL performs rate limiting for restores.\n\nCloud SQL uses tokens from a bucket to determine how many restore operations\nare available at any one time. For each backup, there's a bucket for each target\nproject and target region. The target instances from the same project share one bucket if they are in the same region.\nThere's a maximum of three tokens in each bucket that you can use for restore operations. Every 10 minutes, a new token is added to the bucket. If the bucket\nis full, the token overflows.\n\nEach time you issue a restore operation, a token is granted from the bucket. If\nthe operation succeeds, the token is removed from the bucket. If it fails, the\ntoken is returned to the bucket. The following diagram shows how this works:\n\nFor example, in the following figure, Backup1, Backup2, and Backup3 are the\nbackups from the same source instance.\n\n- Each backup (Backup1, Backup2, and Backup3) has its own bucket of tokens for restore operations that target different instances in Project 1 in Region A (Bucket11A, Bucket21A, and Bucket31A). Because each backup has its own bucket, you can restore each backup to the same instance three times every thirty minutes.\n- Each backup has a bucket for a separate project and for a separate region. For example, if there are five projects in a region, there are five buckets for that backup in that region, one in each project. In the previous figure, we have two projects in region A: Project 1 and Project n.\n - Backup1 has two buckets of tokens for restore operations in Region A. One bucket for Project 1 (Bucket11A), and one bucket for Project n (Bucket1nA).\n - Similarly, Backup3 has two buckets for restore operations in Region A. One for Project 1 (Bucket31A) and one for Project n (Bucket3nA).\n- Backup3 has one bucket in Region B, for Project1, because all instances in the same target project and the same target region share one bucket.\n\nWhat's next\n-----------\n\n- [Perform a restore from a backup](/sql/docs/mysql/backup-recovery/restoring#restorebackups)\n- [Use point-in-time recovery (PITR)](/sql/docs/mysql/backup-recovery/pitr)"]]