Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menghapus snapshot tabel
Dokumen ini menjelaskan cara menghapus snapshot tabel menggunakan konsolGoogle Cloud , pernyataan GoogleSQL DROP SNAPSHOT TABLE, perintah bq rm, atau panggilan tables.delete BigQuery API.
Artikel ini juga memberikan informasi tentang cara memulihkan snapshot tabel yang telah dihapus atau yang habis masa berlakunya dalam tujuh hari terakhir.
Panduan ini ditujukan bagi pengguna yang sudah memahami snapshot tabel.
PROJECT_ID: project ID dari project yang berisi snapshot.
DATASET_NAME: nama set data yang berisi snapshot.
SNAPSHOT_NAME: nama snapshot.
API
Panggil
metode tables.delete
dengan parameter berikut:
Parameter
Nilai
projectId
ID project untuk project yang berisi snapshot.
datasetId
Nama set data yang berisi snapshot
tableId
Nama snapshot.
Memulihkan snapshot tabel yang dihapus atau yang habis masa berlakunya
Anda dapat memulihkan snapshot tabel yang dihapus atau yang habis masa berlakunya dalam tujuh hari terakhir dengan cara yang sama seperti Anda memulihkan tabel standar. Untuk mengetahui informasi selengkapnya, lihat
Memulihkan snapshot tabel.
[[["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."],[[["\u003cp\u003eTable snapshots can be deleted using the Google Cloud console, a \u003ccode\u003eDROP SNAPSHOT TABLE\u003c/code\u003e SQL statement, the \u003ccode\u003ebq rm\u003c/code\u003e command, or a BigQuery API \u003ccode\u003etables.delete\u003c/code\u003e call.\u003c/p\u003e\n"],["\u003cp\u003eTo delete a table snapshot, users need the \u003ccode\u003ebigquery.tables.deleteSnapshot\u003c/code\u003e permission, which is granted by the \u003ccode\u003ebigquery.dataOwner\u003c/code\u003e or \u003ccode\u003ebigquery.admin\u003c/code\u003e roles.\u003c/p\u003e\n"],["\u003cp\u003eDeleting a table snapshot is similar to deleting a standard table, and expired snapshots do not need to be manually deleted.\u003c/p\u003e\n"],["\u003cp\u003eA table snapshot deleted or expired in the past seven days can be recovered in the same way a standard table is recovered.\u003c/p\u003e\n"]]],[],null,["# Delete table snapshots\n======================\n\nThis document describes how to delete a table snapshot by using the\nGoogle Cloud console, a\n[`DROP SNAPSHOT TABLE`](/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement)\nGoogleSQL statement, a\n[`bq rm`](/bigquery/docs/reference/bq-cli-reference#bq_rm) command,\nor a BigQuery API\n[`tables.delete`](/bigquery/docs/reference/rest/v2/tables/delete) call.\nIt also provides information about how to recover a table snapshot that was\ndeleted or that expired in the past seven days.\nIt is intended for users who are familiar with\n[table snapshots](/bigquery/docs/table-snapshots-intro).\n\nPermissions and roles\n---------------------\n\nThis section describes the\n[Identity and Access Management (IAM) permission](/bigquery/docs/access-control#bq-permissions)\nthat you need to delete a table snapshot, and the\n[predefined IAM roles](/bigquery/docs/access-control#bigquery)\nthat grant those permissions.\n\n### Permissions\n\nTo delete a table snapshot, you need the following permission:\n\n### Roles\n\nThe predefined BigQuery roles that provide the required\npermissions are as follows:\n\nDelete a table snapshot\n-----------------------\n\nDelete a table snapshot as you would delete a standard table. You don't need to\ndelete a table snapshot that has expired.\n\nYou can delete a table snapshot by using one of the following options: \n\n### Console\n\n1. In the Google Cloud console, go to the **BigQuery** page.\n\n[Go to BigQuery](https://console.cloud.google.com/bigquery)\n\n1. In the **Explorer** pane, expand the project and dataset nodes of the\n table snapshot you want to look at.\n\n2. Click the name of the table snapshot.\n\n3. In the snapshot pane that appears, click **Delete**.\n\n4. Confirm, and then click **Delete** again.\n\n### SQL\n\nUse the\n[`DROP SNAPSHOT TABLE` DDL statement](/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement):\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\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 ```googlesql\n DROP SNAPSHOT TABLE PROJECT_ID.DATASET_NAME.SNAPSHOT_NAME;\n ```\n\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshot.\n - \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshot.\n - \u003cvar translate=\"no\"\u003eSNAPSHOT_NAME\u003c/var\u003e: the name of the snapshot.\n\n \u003cbr /\u003e\n\n3. Click play_circle **Run**.\n\n \u003cbr /\u003e\n\nFor more information about how to run queries, see [Run an interactive query](/bigquery/docs/running-queries#queries).\n\n### bq\n\nEnter the following command in the Cloud Shell:\n\n[Go to Cloud Shell](https://console.cloud.google.com/bigquery?cloudshell=true) \n\n```bash\nbq rm \\\nPROJECT_ID:DATASET_NAME.SNAPSHOT_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eSNAPSHOT_NAME\u003c/var\u003e: the name of the snapshot.\n\n\u003cbr /\u003e\n\n### API\n\nCall the\n[`tables.delete`](/bigquery/docs/reference/rest/v2/tables/delete)\nmethod with the following parameters:\n\nRestore a deleted or expired table snapshot\n-------------------------------------------\n\nYou can recover a table snapshot that was deleted or that expired in\nthe past seven days in the same way that you recover a standard table. For more\ninformation, see\n[Restore table snapshots](/bigquery/docs/table-snapshots-restore).\n\nWhat's next\n-----------\n\n- [Create monthly snapshots of a table by using a service account that runs a scheduled query](/bigquery/docs/table-snapshots-scheduled)."]]