Jeder erstellte Backup-Tresor ist mit einem eindeutigen Dienst-Agent verknüpft.
Bei Cloud SQL-Instanzen führt der Dienst-Agent Aktionen im Namen des Backup and DR-Dienstes aus. Daher benötigt er die entsprechenden Berechtigungen für die Projekte, auf die er zugreifen muss.
Folgen Sie der Anleitung unten, um dem Dienst-Agent eine Rolle zuzuweisen.
Rufen Sie in der Google Cloud Console die Seite Backup-Tresore auf.
Geben Sie im Feld Neue Hauptkonten die E-Mail-Adresse des Dienst-Agents ein.
Wählen Sie in der Liste Rolle auswählen die Rolle BackupDR Cloud SQL Operator (roles/backupdr.cloudSqlOperator) aus.
Klicken Sie auf Weitere Rolle hinzufügen.
Wählen Sie in der Liste Rolle auswählen die Rolle Dienstkontonutzer (roles/iam.serviceAccountUser) aus.
Klicken Sie auf Speichern.
Cloud SQL-Instanz in einem Backup-Vault sichern
In der Google Cloud Console können Sie Cloud SQL-Instanzen in einem Backup Vault sichern, indem Sie Sicherungspläne anwenden. Sie können auf zwei Arten sichern: Geplante Sicherungen und On-Demand-Sicherungen.
Geplante Sicherung konfigurieren
Gehen Sie so vor, um eine geplante Sicherung für Cloud SQL-Instanzen zu konfigurieren.
Rufen Sie in der Google Cloud Console die Seite Vaulted Backups auf.
Wählen Sie in der Liste Ressourcentyp die Option Cloud SQL aus.
Wählen Sie in der Liste Projekt das Projekt aus, in dem sich die Cloud SQL-Instanz befindet.
Wählen Sie in der Liste Region die Region aus, in der sich Ihre Instanzen befinden.
Klicken Sie in der Liste Ressourcen auf Durchsuchen. Wählen Sie die Cloud SQL-Instanz aus, die Sie sichern möchten, und klicken Sie auf Fertig.
Klicken Sie auf Weiter.
Klicken Sie in der Liste Sicherungsplan auf Auswählen.
Wählen Sie einen Sicherungsplan aus, mit dem Sie die Cloud SQL-Instanz schützen möchten.
Klicken Sie auf Fertig.
Prüfen Sie die Sicherungsdetails und klicken Sie auf Planen.
Da das Sicherungsfenster auf sechs Stunden festgelegt ist, können Sie eine On-Demand-Sicherung der Cloud SQL-Instanz erstellen.
On-Demand-Sicherung erstellen
Sie können eine On-Demand-Sicherung für eine Cloud SQL-Instanz mit einem Sicherungsplan initiieren, indem Sie die sofortige Ausführung der Sicherungsregel auslösen.
So erstellen Sie eine On-Demand-Sicherung:
Rufen Sie in der Google Cloud Console die Seite Vaulted Backups auf.
Auf der Seite Vaulted backups (Vaulted Backups) 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 Ressource aus, die gesichert werden soll. Wählen Sie entweder im Menü more_vert oder auf der Detailseite der Ressource die Option On-Demand-Sicherung erstellen aus.
Wählen Sie im Fenster On-Demand-Sicherung erstellen eine Sicherungsregel aus und klicken Sie auf Erstellen.
Klicken Sie auf Benachrichtigungen, um den Status des On-Demand-Sicherungsjobs aufzurufen.
Rufen Sie in der Google Cloud Console die Seite Jobs auf, um den Status des Sicherungsvorgangs anzusehen.
Auf der Seite Vaulted backups (Gesicherte Backups) werden nur die Instanzen aufgeführt, auf die Sicherungspläne angewendet wurden und deren Sicherungen in einem Backup Vault innerhalb eines 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.
Rufen Sie in der Google Cloud Console die Seite Jobs auf, um den Status des Wiederherstellungsvorgangs anzusehen.
Damit Ihrem Google Cloud -Konto keine Gebühren in Rechnung gestellt werden, löschen Sie die auf dieser Seite verwendeten Ressourcen, wenn Sie sie nicht mehr benötigen.
Folgen Sie der Anleitung unten, um den Sicherungsplan aus der gesicherten Cloud SQL-Instanz zu entfernen.
Rufen Sie in der Google Cloud Console die Seite Vaulted Resources (Gesicherte Ressourcen) auf.
[[["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,["# Quickstart: Protect and recover a Cloud SQL instance to a backup vault\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nLearn how to protect and restore a Cloud SQL instance to a backup vault.\n\nIn this quickstart, you perform the following tasks:\n\n- Configure a scheduled backup for a Cloud SQL instance.\n- Back up a Cloud SQL instance into a backup vault.\n- Restore a Cloud SQL instance from a backup.\n\nBefore you begin\n----------------\n\n1. Enable the Backup and DR Service API in your Google Cloud project.\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=backupdr.googleapis.com&_ga=2.145630134.30427899.1640890668-1982243420.1634228058)\n2. [Create a backup vault](/backup-disaster-recovery/docs/cloud-console/backup-vault-create).\n Backup vaults provide protection for backups by storing them in\n secure, isolated, and specialized storage. For more information about\n backup vaults, see [Backup vault for immutable and indelible backups](/backup-disaster-recovery/docs/concepts/backup-vault).\n\n3. [Create a backup plan](/backup-disaster-recovery/docs/cloud-console/backup-plan-create).\n\nGrant a role to the backup vault service agent\n----------------------------------------------\n\nEvery backup vault created has a unique service agent linked to it.\nFor Cloud SQL instances, the service agent performs actions\non behalf of the Backup and DR Service, so it needs appropriate permissions on\nthe projects it needs to access.\n\nUse the following instructions to grant a role to the service agent.\n\n1. In the Google Cloud console, go to the **Backup vaults** page.\n\n [Go to Backup vaults](https://console.cloud.google.com/backupdr/backup-vaults/list)\n2. Click the backup vault name and copy the service agent's email address.\n\n3. In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/iam-admin/iam)\n4. In the **New principles** field, enter the service agent's email address.\n\n5. From the **Select a role** list, select the **BackupDR Cloud SQL Operator** (`roles/backupdr.cloudSqlOperator`) role.\n\n6. Click **Add another role**.\n\n7. From the **Select a role** list, select the **Service Account User** (`roles/iam.serviceAccountUser`) role.\n\n8. Click **Save**.\n\nBack up a Cloud SQL instance into a backup vault\n------------------------------------------------\n\nIn the Google Cloud console, you can back up Cloud SQL instances to a\nbackup vault by applying backup plans. You can back up in either of\nthese two ways: **Scheduled backups** and **On-demand backups**.\n\n### Configure a scheduled backup\n\nUse the following instructions to configure a scheduled backup for\nCloud SQL instances.\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. Click **Schedule backup**.\n\n3. From the **Resource Type** list, select **Cloud SQL**.\n\n4. From the **Project** list, select the project where the Cloud SQL instance\n is located.\n\n5. From the **Region** list, select the region where your instances are\n located.\n\n6. From the **Resources** list, click **Browse** . Choose the Cloud SQL\n instance that you want to back up and click **Done**.\n\n7. Click **Continue**.\n\n8. From the **Backup plan** list, click **Select**.\n\n9. Choose a backup plan that you want to protect the Cloud SQL instance with.\n\n10. Click **Done**.\n\n11. Review the backup details and click **Schedule**.\n\n As the backup window is set to six hours, you can take an on-demand backup of the Cloud SQL instance.\n | **Note:** The first backup is automatically triggered when the current time is within the backup window.\n\nTake an on-demand backup\n------------------------\n\nInitiate an on-demand backup for a Cloud SQL instance with a backup plan\nby triggering the backup rule to run immediately.\n\nUse the following instructions to create an on-demand backup.\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)\n\n The **Vaulted backups** page lists only the data resources that have\n backup plans applied and their backups stored in a backup vault\n within that project.\n2. Select the resource to back up. Either from the more_vert\n menu, or from the details page for the resource, select **Create on-demand backup**.\n\n3. In the **Create an on-demand backup** window, select a backup rule to use\n and click **Create**.\n\n4. To view the status of the on-demand backup job, click **Notifications**.\n\n | **Note:** The on-demand backup is stored in the backup vault that is configured with the associated backup plan.\n 1. In the Google Cloud console, go to the **Jobs** page to view the backup operation status.\n\n [Go to Jobs](https://console.cloud.google.com/backupdr/jobs)\n\nRestore a Cloud SQL instance from a backup\n------------------------------------------\n\nYou can restore a Cloud SQL instance to the same project or to a\ndifferent project.\n\nUse the following instructions to restore a Cloud SQL instance into a\nbackup vault from a backup.\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)\n\n The **Vaulted backups** page lists only the instances that have\n backup plans applied and their backups stored in a backup vault\n within a project.\n2. Select the backup that you want to restore. Either from the backup\n details page for the backup, or from the\n more_vert menu, select\n **Restore**.\n\n The **Restore page** displays where you select the following restore options:\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 customise 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.\n3. In the Google Cloud console, go to the **Jobs** page to view the restore\n operation status.\n\n [Go to Jobs](https://console.cloud.google.com/backupdr/jobs)\n\nClean up\n--------\n\nTo avoid incurring charges to your Google Cloud account, remember to delete the\nresources used on this page if you have no further use for them.\n\nUse the following instructions to remove the backup plan from the backed up Cloud SQL instance.\n\n1. In the Google Cloud console, go to the **Vaulted resources** page.\n\n [Go to Vaulted resources](https://console.cloud.google.com/backupdr/vaulted-resources)\n2. Select the backed up instance.\n\n3. Click **Remove backup plan**.\n\n | **Note:** The backup automatically expires and gets deleted after the retention period that you set.\n\nUse the following instructions to delete the backup plan. Deleting the backup plan is an optional step.\n\n1. In the Google Cloud console, go to the **Backup plans** page.\n\n [Go to Backup plans](https://console.cloud.google.com/backupdr/backup-plans/list)\n2. Select the backup plan and click **Delete**.\n\n This deletes the backup plan and related contents.\n\nUse the following instructions to delete the backup vault. Deleting the backup vault is an optional step.\n\n1. In the Google Cloud console, go to the **Backup vaults** page.\n\n [Go to Backup vaults](https://console.cloud.google.com/backupdr/backup-vaults/list)\n2. Click the backup vault and click **Delete**.\n\n This deletes the backup vault and related contents.\n | **Note:** The backup vault incurs a cost only when the backup vault stores data. The existence of a backup plan doesn't incur any cost."]]