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.create on the project
  • bigquery.datasets.get on 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:

  1. In the Google Cloud console, go to theBigQuery page.

    Go to BigQuery

  2. In the query editor, enter the following statement:

    UNDROPSCHEMADATASET_ID;

    ReplaceDATASET_ID with the dataset that youwant to undelete.

  3. Specify the locationof the dataset that you want to undelete. To specify the location partof the SQL statement uselocation options

    UNDROPSCHEMADATASET_IDOPTIONS(location=location);

  4. ClickRun.

For more information about how to run queries, seeRun an interactive query.

API

Call thedatasets.undelete method.

Note: If you have two deleted datasets in your project with the same name intwo different regions, undeleting a dataset with the BigQuery APIundeletes only one, selected at random, unless a location is specified.

When you restore a dataset, the following errors might occur:

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.