UNDROP DATABASE
statementsupportedDatabases & schemasRestores the most recent version of a dropped database.
Syntax
UNDROP DATABASE <name>
Parameters
| Name | Required | Description |
|---|---|---|
name | Specifies the identifier for the database to restore. 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. |
Usage notes
- If a database with the same name already exists, an error is returned.
- UNDROP 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 value is 24 hours.
- Hybrid tables that belong to the specified database are not undropped.
- If you have multiple dropped databases with the same name, you can use the IDENTIFIER keyword with the system-generated identifier (from the DATABASES view) to specify which database to restore. The name of the restored database remains the same. 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.
Access control requirements
A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes CREATE DATABASE | Account | 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.