Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Memulihkan set data yang dihapus
Dokumen ini menjelaskan cara memulihkan (atau membatalkan penghapusan) set data yang dihapus di BigQuery.
Anda dapat memulihkan set data untuk memulihkannya ke statusnya saat set data tersebut
dihapus. Anda hanya dapat memulihkan set data yang berada dalam
periode perjalanan waktu Anda.
Pemulihan ini mencakup semua objek yang ada dalam set data, properti set data, dan setelan keamanan. Untuk resource yang tidak dipulihkan, lihat Batasan.
Untuk mengetahui informasi tentang cara memulihkan tabel atau snapshot yang dihapus, lihat referensi
berikut:
Berikut adalah daftar batasan terkait memulihkan set data:
Kumpulan data yang dipulihkan mungkin mereferensikan principal keamanan yang tidak ada lagi.
Referensi ke set data yang dihapus dalam set data tertaut tidak dipulihkan saat Anda melakukan tindakan ini. Pelanggan harus berlangganan lagi untuk memulihkan link secara manual.
Tag bisnis tidak dipulihkan saat Anda melakukan tindakan ini.
Anda tidak dapat memulihkan tampilan logis secara langsung. Untuk mengetahui informasi selengkapnya, lihat Memulihkan tampilan.
Tabel yang mendukung BigQuery CDC
tidak melanjutkan tugas penerapan latar belakang saat dipulihkan sebagai bagian dari
set data yang tidak dihapus.
Jika resource yang diotorisasi (tampilan, set data, dan rutin) dihapus, diperlukan waktu hingga 24 jam agar otorisasi tersebut dihapus. Jadi, jika
Anda memulihkan set data dengan resource yang diotorisasi kurang dari 24 jam setelah
penghapusan, kemungkinan otorisasi ulang tidak diperlukan. Sebagai praktik terbaik, selalu verifikasi otorisasi setelah memulihkan resource.
Sebelum memulai
Pastikan Anda memiliki izin Identity and Access Management (IAM) yang diperlukan untuk
memulihkan set data yang dihapus.
Peran yang diperlukan
Untuk mendapatkan izin yang diperlukan untuk memulihkan set data yang dihapus, minta administrator untuk memberi Anda peran IAM BigQuery User (roles/bigquery.user) di project.
Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.
Peran bawaan ini berisi
izin yang diperlukan untuk memulihkan set data yang dihapus. Untuk melihat izin yang benar-benar diperlukan, luaskan bagian Izin yang diperlukan:
Izin yang diperlukan
Izin berikut diperlukan untuk memulihkan set data yang dihapus:
Saat Anda memulihkan set data, error berikut mungkin terjadi:
ALREADY_EXISTS: set data dengan nama yang sama sudah ada di
region tempat Anda mencoba memulihkan. Anda tidak dapat menggunakan urungkan penghapusan untuk menimpa atau menggabungkan set data.
NOT_FOUND: set data yang Anda coba pulihkan telah melewati periode perjalanan waktu, tidak pernah ada, atau Anda tidak
menentukan lokasi yang benar
dari set data.
ACCESS_DENIED: Anda tidak memiliki
izin
yang diperlukan untuk mengurungkan penghapusan set data ini.
Langkah berikutnya
Untuk mengetahui informasi tentang cara membuat kueri data pada suatu titik waktu, lihat Mengakses data historis.
[[["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-08-17 UTC."],[],[],null,["# Restore deleted datasets\n========================\n\n|\n| **Preview**\n|\n|\n| This 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 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| **Note:** To provide feedback or ask questions related to this preview release, contact [bq-dataset-undelete-feedback@google.com](mailto:bq-dataset-undelete-feedback@google.com).\n\nThis document describes how to restore (or *undelete*) a deleted dataset in\nBigQuery.\n\nYou can restore a dataset to recover it to the state that it was in when it was\ndeleted. You can only restore datasets that are within your\n[time travel window](/bigquery/docs/time-travel#time_travel).\nThis recovery includes all of the objects that were contained in the dataset,\nthe dataset properties, and the security settings. For resources that are not\nrecovered, see\n[Limitations](#limitations).\n| **Caution:** Only the most recent dataset for a given dataset ID can be restored. If you delete a dataset and then create a new dataset with the same ID, you lose the ability to undelete the original dataset. However, you still might be able to [recover specific tables from the deleted dataset](/bigquery/docs/managing-datasets#restore-delete-tables).\n\nFor information about restoring a deleted table or snapshot, see the following\nresources:\n\n- [Restore deleted tables](/bigquery/docs/restore-deleted-tables)\n- [Restore table snapshots](/bigquery/docs/table-snapshots-restore)\n\nLimitations\n-----------\n\nThe following is a list of limitations related to restoring a dataset:\n\n- Restored datasets might reference security principals that no longer exist.\n- References to a deleted dataset in linked datasets aren't restored when you perform this action. Subscribers must subscribe again to manually restore the links.\n- Business tags aren't restored when you perform this action.\n- You must [manually refresh materialized views](/bigquery/docs/materialized-views-manage#manual-refresh) and reauthorize [authorized views](/bigquery/docs/authorized-views#authorize_a_view), [authorized datasets](/bigquery/docs/authorized-datasets#authorize_a_dataset), and [authorized routines](/bigquery/docs/authorized-routines#authorize_routines).\n- You cannot restore a logical view directly. For more information, see [Restore a view](/bigquery/docs/managing-views#restore_a_view).\n- A [BigQuery CDC-enabled table](/bigquery/docs/change-data-capture)\n doesn't resume background apply jobs when restored as part of an\n undeleted dataset.\n\n When authorized resources (views, datasets, and routines) are\n deleted, it takes up to 24 hours for the authorization to delete. So, if\n you restore a dataset with an authorized resource less than 24 hours after\n deletion, it's possible that reauthorization isn't necessary. As a best\n practice, always verify authorization after restoring resources.\n\nBefore you begin\n----------------\n\nEnsure that you have the necessary Identity and Access Management (IAM) permissions to\nrestore a deleted dataset.\n\n### Required roles\n\n\nTo get the permissions that\nyou need to restore a deleted dataset,\n\nask your administrator to grant you the\n\n\n[BigQuery User](/iam/docs/roles-permissions/bigquery#bigquery.user) (`roles/bigquery.user`)\nIAM role on the project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains\n\nthe permissions required to restore a deleted dataset. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to restore a deleted dataset:\n\n- ` bigquery.datasets.create` on the project\n- `bigquery.datasets.get` on the dataset\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nRestore a dataset\n-----------------\n\nTo restore a dataset, select one of the following options: \n\n### SQL\n\nUse the\n[`UNDROP SCHEMA` data definition language (DDL) statement](/bigquery/docs/reference/standard-sql/data-definition-language#undrop_schema_statement):\n\n1. In the Google Cloud console, go to the **BigQuery** page.\n\n [Go to BigQuery](https://console.cloud.google.com/bigquery)\n2. In the query editor, enter the following statement:\n\n UNDROP SCHEMA \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eDATASET_ID\u003c/span\u003e\u003c/var\u003e;\n\n Replace \u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e with the dataset that you\n want to undelete.\n3. [Specify the location](/bigquery/docs/locations#specify_locations)\n of the dataset that you want to undelete.\n\n4. Click play_circle **Run**.\n\nFor more information about how to run queries, see [Run an interactive query](/bigquery/docs/running-queries#queries).\n\n### API\n\nCall the\n[`datasets.undelete` method](/bigquery/docs/reference/rest/v2/datasets/undelete).\n| **Note:** If you have two deleted datasets in your project with the same name in two different regions, undeleting a dataset with the BigQuery API undeletes only one, selected at random, unless a location is specified.\n\nWhen you restore a dataset, the following errors might occur:\n\n- `ALREADY_EXISTS`: a dataset with the same name already exists in the region in which you tried to restore. You can't use undelete to overwrite or merge datasets.\n- `NOT_FOUND`: the dataset you're trying to recover is past its time travel window, it never existed, or you didn't [specify the correct location](/bigquery/docs/locations#specify_locations) of the dataset.\n- `ACCESS_DENIED`: you don't have the required\n [permissions](#before-you-begin)\n to undelete this dataset.\n\n What's next\n -----------\n\n- For information about querying data at a point in time, see [Access historical data](/bigquery/docs/access-historical-data).\n\n- For information about data retention, see [Data retention with time travel and fail-safe](/bigquery/docs/time-travel).\n\n- For information about how to delete a dataset, see [Manage datasets](/bigquery/docs/managing-datasets)."]]