Restore deleted datasets
Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
Note: To provide feedback or ask questions related to this preview release,contactbq-dataset-undelete-feedback@google.com.This document describes how to restore (orundelete) a deleted dataset inBigQuery.
You can restore a dataset to recover it to the state that it was in when it wasdeleted. You can only restore datasets that are within yourtime travel window.This recovery includes all of the objects that were contained in the dataset,the dataset properties, and the security settings. For resources that are notrecovered, seeLimitations.
Caution: Only the most recent dataset for a given dataset ID can berestored. If you delete a dataset and then create a new dataset with the sameID, you lose the ability to undelete the original dataset. However, you stillmight be able torecover specific tables from the deleted dataset.For information about restoring a deleted table or snapshot, see the followingresources:
Limitations
The following is a list of limitations related to restoring a dataset:
- Restored datasets might reference security principals that no longer exist.
- References to a deleted dataset in linked datasets aren't restored whenyou perform this action. Subscribers must subscribe again to manually restorethe links.
- Business tags aren't restored when you perform this action.
- You mustmanually refresh materialized views and reauthorizeauthorized views,authorized datasets,andauthorized routines.
- You can't restore a logical view directly. However, you can undelete thedataset or recreate the view to restore your logical view. For moreinformation on these workarounds, seeRestore a view.
- ABigQuery CDC-enabled tabledoesn't resume background apply jobs when restored as part of anundeleted dataset.
It can take up to 24 hours for a restored dataset to appear inBigQuery search results.
When authorized resources (views, datasets, and routines) aredeleted, it takes up to 24 hours for the authorization to delete. So, ifyou restore a dataset with an authorized resource less than 24 hours afterdeletion, it's possible that reauthorization isn't necessary. As a bestpractice, always verify authorization after restoring resources.
Before you begin
Ensure that you have the necessary Identity and Access Management (IAM) permissions torestore a deleted dataset.
Required roles
To get the permissions that you need to restore a deleted dataset, ask your administrator to grant you theBigQuery User (roles/bigquery.user) IAM role on the project. For more information about granting roles, seeManage access to projects, folders, and organizations.
This predefined role contains the permissions required to restore a deleted dataset. To see the exact permissions that are required, expand theRequired permissions section:
Required permissions
The following permissions are required to restore a deleted dataset:
bigquery.datasets.createon the projectbigquery.datasets.geton the dataset
You might also be able to get these permissions withcustom roles or otherpredefined roles.
Restore a dataset
To restore a dataset, select one of the following options:
SQL
Use theUNDROP SCHEMA data definition language (DDL) statement:
In the Google Cloud console, go to theBigQuery page.
In the query editor, enter the following statement:
UNDROPSCHEMA
DATASET_ID;Replace
DATASET_IDwith the dataset that youwant to undelete.Specify the locationof the dataset that you want to undelete. To specify the location partof the SQL statement use
locationoptionsUNDROPSCHEMA
DATASET_IDOPTIONS(location=location);ClickRun.
For more information about how to run queries, seeRun an interactive query.
API
Call thedatasets.undelete method.
When you restore a dataset, the following errors might occur:
ALREADY_EXISTS: a dataset with the same name already exists in theregion in which you tried to restore. You can't use undelete to overwrite ormerge datasets.NOT_FOUND: the dataset you're trying to recover is past its timetravel window, it never existed, or you didn'tspecify the correct locationof the dataset.ACCESS_DENIED: you don't have the requiredpermissionsto undelete this dataset.What's next
For information about querying data at a point in time, seeAccess historical data.
For information about data retention, seeData retention with time travel and fail-safe.
For information about how to delete a dataset, seeManage datasets.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.