Memulihkan instance Cloud SQL dari cadangan terbaru
Gunakan petunjuk berikut untuk memulihkan instance Cloud SQL.
Konsol
Di konsol Google Cloud , buka halaman Cadangan yang di-Vault.
Pengguna akhir harus memiliki peran/cloudsql.admin di project tempat instance target berada.
Pengguna akhir harus memiliki peran/backupdr.restoreUser dalam project tempat cadangan sumber berada.
Buka Cadangan yang disimpan di Vault
Halaman Cadangan yang disimpan di Vault hanya mencantumkan resource data yang telah menerapkan paket pencadangan dan cadangannya disimpan di Vault cadangan dalam project tersebut.
Pilih cadangan yang ingin Anda pulihkan. Baik dari halaman detail cadangan untuk cadangan, atau dari menu more_vert, pilih Pulihkan.
Halaman Pemulihan akan ditampilkan tempat Anda memilih opsi pemulihan berikut:
Jenis resource telah diisi otomatis dengan Cloud SQL.
Di Nama resource, pilih instance Cloud SQL yang akan dipulihkan.
Saat Anda mengklik Cadangkan, panel akan terbuka dan menampilkan semua cadangan yang tersedia.
Pilih cadangan tertentu yang akan dipulihkan.
Untuk Choose the restore destination, pilih project yang ingin Anda gunakan untuk memulihkan instance Cloud SQL.
Klik Lanjutkan.
Halaman berikutnya menampilkan detail pemulihan sejauh ini, dan meminta Anda untuk
Pilih tujuan pemulihan, dengan opsi berikut:
Pulihkan ke instance baru: Tindakan ini akan membuat instance baru berdasarkan
konfigurasi yang disimpan dalam cadangan Anda. Anda dapat menyesuaikan instance setelah pemulihan selesai. Berikan ID Instance baru menggunakan huruf kecil, angka, dan tanda hubung. Awali dengan huruf.
Menimpa instance yang ada: Pilih instance yang ada untuk
ditimpa dari daftar instance yang tersedia.
Menimpa instance sumber: Tindakan ini akan menimpa instance Anda saat ini. Semua data terkini pada instance yang dipilih akan ditimpa,
termasuk log pemulihan point-in-time sebelumnya. Data yang ditimpa tidak dapat dipulihkan nanti. Fitur ini tidak direkomendasikan untuk penggunaan produksi.
gcloud
Sebelum memulai
Anda harus menemukan terlebih dahulu sumber data yang berisi cadangan yang ingin dipulihkan. Anda dapat menemukan sumber data dari project instance Cloud SQL atau project vault cadangan:
Dari project instance Cloud SQL: Gunakan data-source-reference
Buat daftar dan pilih cadangan yang akan dipulihkan. Anda harus mencantumkan semua cadangan di sumber data. Untuk melakukannya, gunakan perintah backups list.
Di bagian atas tabel, pilih Filter tabel>Jenis resource.
Pilih Cloud SQL. Hal ini membatasi tampilan hanya pada instance Cloud SQL yang menerapkan rencana pencadangan dan pencadangannya disimpan di brankas cadangan dalam project.
Klik Pulihkan dari titik waktu.
Halaman Create a clone Cloud SQL akan terbuka.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]