DROP SNAPSHOT

备注

Snowflake 的支持政策和服务级别协议 中规定的服务级别目前不包括此操作。

Removes a snapshot of a block storage volume. A snapshot is persisted data that the customer pays for. DROP SNAPSHOT tells Snowflake to delete that data. The data is no longer available for use as a snapshot and the customer no longer pays for it.

另请参阅:

CREATE SNAPSHOTALTER SNAPSHOTDESCRIBE SNAPSHOTSHOW SNAPSHOTS

语法

DROP SNAPSHOT [ IF EXISTS ] <name>;
Copy

参数

name

指定要删除的快照的标识符。

如果标识符包含空格或特殊字符,则整个字符串必须放在双引号内。放在双引号内的标识符也区分大小写。

有关更多信息,请参阅 标识符要求

访问控制要求

用于执行此操作的 角色 必须至少具有以下 权限

权限

对象

备注

OWNERSHIP

快照

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).

Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema.

有关创建具有指定权限集的自定义角色的说明,请参阅 创建自定义角色

有关对 安全对象 执行 SQL 操作的相应角色和权限授予的一般信息,请参阅 访问控制概述

使用说明

  • 如果指定了 IF EXISTS 子句,而目标对象不存在,该命令会成功完成,不会返回错误。

  • Dropping a snapshot does not immediately remove it from the system. A version of the dropped snapshot is retained in Time Travel for the number of days specified by the DATA_RETENTION_TIME_IN_DAYS parameter for the parent schema, database, or account:

    • Within the Time Travel retention period, a dropped snapshot can be restored using the UNDROP SNAPSHOT command.

    • After the Time Travel retention period, it is permanently removed; it must be recreated.

    For more information, see 数据保留期.

  • To immediately drop a snapshot without retention, set DATA_RETENTION_TIME_IN_DAYS to 0 at the schema level where the snapshot resides. This setting also effects the retention period for other objects within that schema.

示例

以下示例删除名为 example_snapshot 的快照:

DROP SNAPSHOT example_snapshot;
Copy
+----------------------------------------+
| status                                 |
|----------------------------------------|
| EXAMPLE_SNAPSHOT successfully dropped. |
+----------------------------------------+
语言: 中文