Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Restablece los conjuntos de datos borrados
En este documento, se describe cómo restablecer (o recuperar) un conjunto de datos borrado en BigQuery.
Puedes restablecer un conjunto de datos para recuperarlo al estado que tenía cuando se borró. Solo puedes restablecer conjuntos de datos que se encuentren dentro de tu período de viaje en el tiempo.
Esta recuperación incluye todos los objetos que se encontraban en el conjunto de datos, las propiedades del conjunto de datos y la configuración de seguridad. Para los recursos que no se recuperan, consulta Limitaciones.
Para obtener información sobre cómo restablecer una tabla o una instantánea borrada, consulta los siguientes recursos:
A continuación, se incluye una lista de limitaciones relacionadas con la restauración de un conjunto de datos:
Los conjuntos de datos restablecidos pueden hacer referencia a las principales de seguridad que ya no existen.
Las referencias a un conjunto de datos borrado en los conjuntos de datos vinculados no se restablecen cuando realizas esta acción. Los suscriptores deben volver a suscribirse para restablecer los vínculos manualmente.
Las etiquetas de la empresa no se restablecen cuando realizas esta acción.
No puedes restablecer una vista lógica directamente. Para obtener más información, consulta Cómo restablecer una vista.
Una tabla habilitada para la CDC de BigQuery no reanuda los trabajos de aplicación en segundo plano cuando se restablece como parte de un conjunto de datos no borrado.
Cuando se borran recursos autorizados (vistas, conjuntos de datos y rutinas), la autorización tarda hasta 24 horas en borrarse. Por lo tanto, si restableces un conjunto de datos con un recurso autorizado menos de 24 horas después de la eliminación, es posible que no sea necesario volver a autorizarlo. Como práctica recomendada, siempre verifica la autorización después de restablecer los recursos.
Antes de comenzar
Asegúrate de tener los permisos necesarios de Identity and Access Management (IAM) para restablecer un conjunto de datos borrado.
Roles requeridos
Para obtener los permisos que necesitas para restablecer un conjunto de datos borrado, pídele a tu administrador que te otorgue el rol de IAM usuario de BigQuery (roles/bigquery.user) en el proyecto.
Para obtener más información sobre cómo otorgar roles, consulta Administra el acceso a proyectos, carpetas y organizaciones.
Este rol predefinido contiene los permisos necesarios para restablecer un conjunto de datos borrado. Para ver los permisos exactos que son necesarios, expande la sección Permisos requeridos:
Permisos necesarios
Se requieren los siguientes permisos para restablecer un conjunto de datos borrado:
Cuando restableces un conjunto de datos, pueden ocurrir los siguientes errores:
ALREADY_EXISTS: Ya existe un conjunto de datos con el mismo nombre en la región en la que intentaste restablecerlo. No puedes usar la recuperación para reemplazar o combinar los conjuntos de datos.
NOT_FOUND: El conjunto de datos que intentas recuperar ya pasó su período de viaje en el tiempo, nunca existió o no especificaste la ubicación correcta del conjunto de datos.
ACCESS_DENIED: No tienes los permisos necesarios para recuperar este conjunto de datos.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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)."]]