UNDROP DATABASE¶
恢复已删除数据库的最新版本。
语法¶
UNDROP DATABASE <name>
参数¶
name
指定要恢复的数据库的标识符。如果标识符包含空格或特殊字符,则整个字符串必须放在双引号内。放在双引号内的标识符也区分大小写。
使用说明¶
如果已存在同名数据库,则返回错误。
UNDROP 依赖于 Snowflake Time Travel 功能。仅当在 数据保留期 中删除对象后,才能恢复该对象。默认值为 24 小时。
示例¶
还原已删除数据库的最新版本(此示例基于 DROP DATABASE 示例而构建):
UNDROP DATABASE mytestdb2; +-------------------------------------------+ | status | |-------------------------------------------| | Database MYTESTDB2 successfully restored. | +-------------------------------------------+ SHOW DATABASES HISTORY; +---------------------------------+-----------+------------+------------+--------+--------+---------+---------+----------------+------------+ | created_on | name | is_default | is_current | origin | owner | comment | options | retention_time | dropped_on | |---------------------------------+-----------+------------+------------+--------+--------+---------+---------+----------------+------------| | Tue, 17 Mar 2015 16:57:04 -0700 | MYTESTDB | N | Y | | PUBLIC | | | 1 | [NULL] | | Tue, 17 Mar 2015 17:06:32 -0700 | MYTESTDB2 | N | N | | PUBLIC | | | 1 | [NULL] | | Wed, 25 Feb 2015 17:30:04 -0800 | SALES1 | N | N | | PUBLIC | | | 1 | [NULL] | | Fri, 13 Feb 2015 19:21:49 -0800 | DEMO1 | N | N | | PUBLIC | | | 1 | [NULL] | +---------------------------------+-----------+------------+------------+--------+--------+---------+---------+----------------+------------+