UNDROP SNAPSHOT¶
Note
This operation is not currently covered by the Service Level set forth in Snowflake’s Support Policy and Service Level Agreement.
Restores a previously removed snapshot of a block storage volume. After Snowflake restores the snapshot, the data is available for use.
- See also:
Syntax¶
UNDROP SNAPSHOT { <name> | IDENTIFIER( <id> ) }
[ RENAME TO <new_snapshot_name> ];
Parameters¶
nameSpecifies the name of the snapshot to restore. If you specify a snapshot name, the command restores the most recently dropped snapshot with that name.
If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
For more information, see Identifier requirements.
IDENTIFIER( id )Specifies the system-generated identifier for the snapshot to restore.
If you have multiple dropped snapshots with the same name, you can query the BLOCK_STORAGE_SNAPSHOTS view to get the system-generated identifier of the dropped snapshot that you want to restore. Then, use the IDENTIFIER keyword to specify that you want to restore this snapshot. The restored snapshot keeps its original name.
For an example of restoring a snapshot by system-generated identifier, see Examples.
Note
You can only use the system-generated identifier with the IDENTIFIER() keyword when executing the UNDROP command for notebooks, tables, block storage snapshots, schemas, and databases.
RENAME TO new_snapshot_nameSpecifies the name for the snapshot after it is restored. This lets you restore the snapshot to a different name.
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
Privilege |
Object |
Notes |
|---|---|---|
OWNERSHIP |
Snapshot |
OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object, but can also be transferred using the GRANT OWNERSHIP command to a different role by the owning role (or any role with the MANAGE GRANTS privilege). |
The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema. Note that a role granted any privilege on a schema allows that role to resolve the schema. For example, a role granted CREATE privilege on a schema can create objects on that schema without also having USAGE granted on that schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶
Snapshots can only be restored to the database and schema where the snapshot was located at the time of deletion. For example, if you create and drop a snapshot in schema
s1, then change the current schema in your session tos2and attempt to undrop the snapshot, the snapshot will be restored in schemas1, not in the current schemas2.If a snapshot with the same name already exists, UNDROP SNAPSHOT returns an error. In this case, you have the option to specify a different name by using
RENAME TOparameter.UNDROP SNAPSHOT relies on the Snowflake Time Travel feature. An object can be restored only if the object was deleted within the data retention period. The default retention period is 24 hours. After the data retention period has passed, you can’t restore the snapshot.
Examples¶
Restore snapshot using name¶
The following example restores a previously dropped snapshot named example_snapshot:
UNDROP SNAPSHOT example_snapshot;
+--------------------------------------------------+
| status |
|--------------------------------------------------|
| Snapshot EXAMPLE_SNAPSHOT successfully restored. |
+--------------------------------------------------+
Restore snapshot using ID¶
Restore a dropped snapshot by ID using IDENTIFIER(). You can find the snapshot ID of the specific snapshot to restore by using the snapshot_id column in the BLOCK_STORAGE_SNAPSHOTS view view. For example, if you have multiple dropped snapshots named MY_SNAPSHOT, and you want to restore the second-to-last dropped snapshot MY_SNAPSHOT, follow these steps:
In the Account Usage LOCK_STORAGE_SNAPSHOTS view, find the table ID of the dropped table:
SELECT snapshot_id, snapshot_name, database_name, schema_name, created_on, deleted_on FROM SNOWFLAKE.ACCOUNT_USAGE.BLOCK_STORAGE_SNAPSHOTS WHERE database_name = 'TUTORIAL_DB' AND schema_name = 'DATA_SCHEMA' AND snapshot_name = 'MY_SNAPSHOT' AND deleted_on IS NOT NULL ORDER BY deleted_on;
Example output:
+-------------+---------------+---------------+-------------+-------------------------------+-------------------------------+ | SNAPSHOT_ID | SNAPSHOT_NAME | DATABASE_NAME | SCHEMA_NAME | CREATED_ON | DELETED_ON | |-------------+---------------+---------------+-------------+-------------------------------+-------------------------------| | 1 | MY_SNAPSHOT | TUTORIAL_DB | DATA_SCHEMA | 2025-09-06 09:51:47.131 -0700 | 2025-09-15 14:21:49.683 -0700 | +-------------+---------------+---------------+-------------+-------------------------------+-------------------------------+
Undrop
MY_SNAPSHOTby snapshot ID; to restore the second-to-last deleted snapshot, use snapshot ID 1 from the output of the previous statement.After you execute the following statement, the snapshot is restored with its original name,
MY_SNAPSHOT:UNDROP SNAPSHOT IDENTIFIER(1);