Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Ripristinare i set di dati eliminati
Questo documento descrive come ripristinare (o recuperare) un set di dati eliminato in
BigQuery.
Puoi ripristinare un set di dati per riportarlo allo stato in cui si trovava al momento dell'eliminazione. Puoi ripristinare solo i set di dati che rientrano nella tua
finestra di spostamento cronologico.
Questo recupero include tutti gli oggetti contenuti nel set di dati,
le proprietà del set di dati e le impostazioni di sicurezza. Per le risorse non
recuperate, vedi
Limitazioni.
Per informazioni sul ripristino di una tabella o di uno snapshot eliminato, consulta le seguenti
risorse:
Di seguito è riportato un elenco delle limitazioni relative al ripristino di un set di dati:
I set di dati ripristinati potrebbero fare riferimento a entità di sicurezza che non esistono più.
I riferimenti a un set di dati eliminato nei set di dati collegati non vengono ripristinati quando
esegui questa azione. Gli iscritti devono abbonarsi di nuovo per ripristinare manualmente
i link.
I tag dell'attività non vengono ripristinati quando esegui questa azione.
Una tabella abilitata per CDC di BigQuery
non riprende i job di applicazione in background quando viene ripristinata nell'ambito di un
set di dati eliminato.
Quando le risorse autorizzate (visualizzazioni, set di dati e routine) vengono
eliminate, sono necessarie fino a 24 ore prima che l'autorizzazione venga eliminata. Pertanto, se ripristini un set di dati con una risorsa autorizzata meno di 24 ore dopo l'eliminazione, è possibile che non sia necessaria una nuova autorizzazione. Come best
practice, verifica sempre l'autorizzazione dopo il ripristino delle risorse.
Prima di iniziare
Assicurati di disporre delle autorizzazioni Identity and Access Management (IAM) necessarie per
ripristinare un set di dati eliminato.
Ruoli obbligatori
Per ottenere le autorizzazioni necessarie per ripristinare un set di dati eliminato, chiedi all'amministratore di concederti il ruolo IAM Utente BigQuery (roles/bigquery.user) nel progetto.
Per saperne di più sulla concessione dei ruoli, consulta Gestisci l'accesso a progetti, cartelle e organizzazioni.
Questo ruolo predefinito contiene
le autorizzazioni necessarie per ripristinare un set di dati eliminato. Per vedere quali sono esattamente le autorizzazioni richieste, espandi la sezione Autorizzazioni obbligatorie:
Autorizzazioni obbligatorie
Per ripristinare un set di dati eliminato sono necessarie le seguenti autorizzazioni:
Quando ripristini un set di dati, potrebbero verificarsi i seguenti errori:
ALREADY_EXISTS: esiste già un set di dati con lo stesso nome nella
regione in cui hai tentato il ripristino. Non puoi utilizzare il ripristino per sovrascrivere o
unire i set di dati.
NOT_FOUND: il set di dati che stai tentando di recuperare non è più disponibile, non è mai esistito o non hai specificato la posizione corretta del set di dati.
ACCESS_DENIED: non disponi delle
autorizzazioni
necessarie per ripristinare questo set di dati.
Passaggi successivi
Per informazioni sull'esecuzione di query sui dati in un determinato momento, consulta Accedere ai dati storici.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 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)."]]