Cloud SQL-Instanz aus der letzten Sicherung wiederherstellen
Folgen Sie der Anleitung unten, um eine Cloud SQL-Instanz wiederherzustellen.
Console
Rufen Sie in der Google Cloud Console die Seite Vaulted Backups auf.
Der Endnutzer muss die Rolle „roles/cloudsql.admin“ in dem Projekt haben, in dem sich die Zielinstanz befindet.
Der Endnutzer muss die Rolle „roles/backupdr.restoreUser“ im Projekt mit den Quellsicherungen haben.
Zu Vault-Sicherungen
Auf der Seite Vault-Sicherungen werden nur die Datenressourcen aufgeführt, auf die Sicherungspläne angewendet wurden und deren Sicherungen in einem Backup Vault innerhalb dieses Projekts gespeichert sind.
Wählen Sie die Sicherung aus, die Sie wiederherstellen möchten. Wählen Sie entweder auf der Seite mit den Sicherungsdetails für die Sicherung oder im more_vert-Menü die Option Wiederherstellen aus.
Auf der Seite Seite wiederherstellen können Sie die folgenden Wiederherstellungsoptionen auswählen:
Das Feld Ressourcentyp ist mit Cloud SQL vorausgefüllt.
Wählen Sie unter Ressourcenname die Cloud SQL-Instanz aus, die wiederhergestellt werden soll.
Wenn Sie auf Sicherung klicken, wird ein Bereich mit allen verfügbaren Sicherungen geöffnet.
Wählen Sie die Sicherung aus, die Sie wiederherstellen möchten.
Wählen Sie unter Wiederherstellungsziel auswählen das Projekt aus, in dem Sie die Cloud SQL-Instanz wiederherstellen möchten.
Klicken Sie auf Weiter.
Auf der nächsten Seite werden die bisherigen Wiederherstellungsdetails angezeigt. Sie werden aufgefordert, ein Wiederherstellungsziel auszuwählen. Dazu haben Sie folgende Möglichkeiten:
Auf einer neuen Instanz wiederherstellen: Anhand der in der Sicherung gespeicherten Konfiguration wird eine neue Instanz erstellt. Sie können die Instanz nach Abschluss der Wiederherstellung anpassen. Geben Sie eine neue Instanz-ID mit Kleinbuchstaben, Ziffern und Bindestrichen ein. Muss mit einem Buchstaben beginnen.
Vorhandene Instanz überschreiben: Wählen Sie eine vorhandene Instanz aus der Liste der verfügbaren Instanzen aus, die überschrieben werden soll.
Quellinstanz überschreiben: Dadurch wird Ihre aktuelle Instanz überschrieben. Alle aktuellen Daten in der ausgewählten Instanz werden überschrieben, einschließlich früherer Logs zur Wiederherstellung zu einem bestimmten Zeitpunkt. Die überschriebenen Daten können später nicht wiederhergestellt werden. Dies wird für die Produktion nicht empfohlen.
gcloud
Hinweise
Sie müssen zuerst die Datenquelle finden, die die Sicherung enthält, die Sie wiederherstellen möchten. Sie können die Datenquelle in einem Cloud SQL-Instanzprojekt oder einem Sicherungsspeicherprojekt finden:
Aus dem Cloud SQL-Instanzprojekt: data-source-reference verwenden
Suchen Sie die Sicherung, die Sie wiederherstellen möchten, und wählen Sie sie aus. Sie müssen alle Sicherungen in der Datenquelle auflisten. Verwenden Sie dazu den Befehl backups list.
Cloud SQL-Instanz zu einem anderen Zeitpunkt wiederherstellen
Gehen Sie so vor, um eine Cloud SQL-Instanz zu einem bestimmten Zeitpunkt wiederherzustellen. Wenn Sie eine Wiederherstellung zu einem bestimmten Zeitpunkt durchführen, erstellen Sie einen Cloud SQL-Klon.
Rufen Sie in der Google Cloud Console die Seite Vaulted Backups auf.
Wählen Sie oben in der Tabelle Tabelle filtern>Ressourcentyp aus.
Wählen Sie Cloud SQL aus. Dadurch wird die Anzeige auf die Cloud SQL-Instanzen beschränkt, auf die Sicherungspläne angewendet wurden und deren Sicherungen in einem Backup Vault innerhalb eines Projekts gespeichert sind.
Klicken Sie auf Von einem bestimmten Zeitpunkt wiederherstellen.
Die Cloud SQL-Seite Klon erstellen wird geöffnet.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Restore a Cloud SQL instance from a backup vault\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\nRestore a Cloud SQL instance from the most recent backup\n--------------------------------------------------------\n\nUse the following instructions to restore a Cloud SQL instance. \n\n### Console\n\n1. In the Google Cloud console, go to the **Vaulted backups** page.\n\n- End user should have roles/cloudsql.admin in the project where the target instance lives.\n- End user should have roles/backupdr.restoreUser in the project where the source backups exists. [Go to Vaulted backups](https://console.cloud.google.com/backupdr/vaulted-backups) The **Vaulted backups** page lists only the data resources that have backup plans applied and their backups stored in a backup vault within that project.\n\n1. Select the backup that you want to restore. Either from the backup details page for the backup, or from the more_vert menu, select **Restore**.\n\nThe **Restore page** displays where you select the following restore options:\n\n- The **Resource type** is prefilled with `Cloud SQL`.\n- In **Resource name**, select the Cloud SQL instance to restore.\n- When you click **Backup**, a pane opens showing all available backups. Select the specific backup to restore.\n- For **Choose the restore destination**, select the project into which you want to restore the Cloud SQL instance.\n- Click **Continue**.\n- The next page shows the restore details so far, and prompts you to\n **Choose restore destination**, with these options:\n\n - **Restore to a new instance** : This creates a new instance based on the configuration stored in your backup. You can customize the instance after the restore is complete. Provide a new **Instance ID** using lowercase letters, numbers, and hyphens. Start with a letter.\n - **Overwrite an existing instance**: Select an existing instance to overwrite from the list of available instances.\n - **Overwrite the source instance**: This will overwrite your current instance. All the current data on the selected instance will be overwritten, including previous point-in-time recovery logs. The overwritten data cannot be recovered later. This is not recommended for production use.\n\n### gcloud\n\n### Before you begin\n\n1. You need to first find the data source that contains the backup that you\n want to restore. You can find the data source from a Cloud SQL instance\n project or a backup vault project:\n\n - From Cloud SQL instance project: Use `data-source-reference`\n\n gcloud alpha backup-dr data-source-references fetch-for-resource-type sqladmin.googleapis.com/Instance \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003eCSQL_INSTANCE_PROJECT_ID\u003c/var\u003e \\\n --filter='dataSourceGcpResourceInfo.cloudSqlInstanceProperties.name=\"projects/\u003cvar translate=\"no\"\u003eCSQL_INSTANCE_PROJECT_ID\u003c/var\u003e/instances/\u003cvar translate=\"no\"\u003eCSQL_INSTANCE_ID\u003c/var\u003e\"' \\\n --format=\"table(RESOURCE_NAME,DATA_SOURCE)\"\n\n Replace the following: \n\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eLOCATION\u003c/span\u003e\u003c/var\u003e: the location of the backup vault.\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eCSQL_INSTANCE_ID\u003c/span\u003e\u003c/var\u003e: the database name of the Cloud SQL instance.\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eCSQL_INSTANCE_PROJECT_ID\u003c/span\u003e\u003c/var\u003e: the project containing the Cloud SQL instance.\n\n - From a backup vault project: Use `data-source`\n\n gcloud backup-dr data-sources list \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003eBACKUP_VAULT_PROJECT_ID\u003c/var\u003e \\\n --filter='dataSourceGcpResource.cloudSqlInstanceDatasourceProperties.name=projects/\u003cvar translate=\"no\"\u003eCSQL_INSTANCE_PROJECT_ID\u003c/var\u003e/instances/\u003cvar translate=\"no\"\u003eCSQL_INSTANCE_ID\u003c/var\u003e' \\\n --format=\"table(dataSourceGcpResource.cloudSqlInstanceDatasourceProperties.name:label=RESOURCE_NAME,name:label=DATA_SOURCE)\"\n\n Replace the following: \n\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eLOCATION\u003c/span\u003e\u003c/var\u003e: the location of the backup vault.\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eCSQL_INSTANCE_ID\u003c/span\u003e\u003c/var\u003e: the name of the Cloud SQL instance.\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eCSQL_INSTANCE_PROJECT_ID\u003c/span\u003e\u003c/var\u003e: the project containing the Cloud SQL instance.\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eBACKUP_VAULT_PROJECT_ID\u003c/span\u003e\u003c/var\u003e: the project containing the backup vault.\n\n2. List and select the backup to restore. You need to list all the backups\n in the data source. To do this, use the `backups list` command.\n\n gcloud backup-dr backups list --data-source=\u003cvar translate=\"no\"\u003eDATA_SOURCE\u003c/var\u003e \\\n --format=\"table(consistencyTime,backupType,name:label=BACKUP_NAME)\"\n\n### Restoring the backup\n\nTo restore a Cloud SQL instance using the Cloud SQL restore command,\nuse the following commands. \n\n gcloud sql backups restore \u003cvar translate=\"no\"\u003eBACKUP_NAME\u003c/var\u003e \\\n --restore-instance=\u003cvar translate=\"no\"\u003eRESTORE_INSTANCE\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003eRESTORE_PROJECT\u003c/var\u003e\n\nReplace the following: \n\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eBACKUP_NAME\u003c/span\u003e\u003c/var\u003e: the backup vault name you want to restore data from.\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eRESTORE_INSTANCE\u003c/span\u003e\u003c/var\u003e: The target Cloud SQL instance name.\n + \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eRESTORE_PROJECT\u003c/span\u003e\u003c/var\u003e: the project where you want to restore the Cloud SQL instance.\n\nTo override other properties, see [Overview of Backup and DR Service Google Cloud CLI commands](https://cloud.google.com/sdk/gcloud/reference/alpha/backup-dr/backups/restore).\n\nRestore a Cloud SQL instance to a different point-in-time\n---------------------------------------------------------\n\nUse the following instructions to restore a Cloud SQL instance to a point in\ntime. When you restore to a point in time, you create a Cloud SQL clone.\n\n1. In the Google Cloud console, go to the **Vaulted backups** page.\n\n [Go to Vaulted backups](https://console.cloud.google.com/backupdr/vaulted-backups)\n2. At the top of the table, select **Filter table** \\\u003e **Resource type** .\n Select **Cloud SQL**. This limits the display to only the Cloud SQL\n instances that have backup plans applied and their backups stored in a\n backup vault within a project.\n\n3. Click **Restore from a point in time** .\n The Cloud SQL **Create a clone** page opens.\n\n4. Follow the procedures in [Perform PITR by using the backup vault](/sql/docs/mysql/backup-recovery/pitr#backup-vault-pitr)."]]