SHOW SNAPSHOTS IN SNAPSHOT SET

Lists all the snapshots in a snapshot set.

另请参阅:

CREATE SNAPSHOT SET, ALTER SNAPSHOT SET, SHOW SNAPSHOT SETS

语法

SHOW SNAPSHOTS IN SNAPSHOT SET <name>
Copy

参数

name

Specifies the identifier for the snapshot set.

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

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

访问控制要求

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

权限

备注

OWNERSHIP

You must have the OWNERSHIP privilege on the snapshot set to see the snapshots that it contains.

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

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

使用说明

  • 该命令 最多 返回指定对象类型的 1 万条记录,由用于执行命令的角色的访问权限决定。即使应用了筛选器,也不会返回任何超出 1 万条限制后的记录。

    要查看存在超过 1 万条记录的结果,请在 Snowflake Information Schema 中查询相应的视图(如果存在)。

输出

描述

created_on

Timestamp snapshot is created.

snapshot_id

Snowflake-generated identifier of the snapshot. The snapshot ID is a UUID value, in the format returned by the UUID_STRING function.

snapshot_set_name

Name of snapshot set that contains the snapshot.

database_name

Name of database that contains the snapshot set.

schema_name

Name of schema that contains the snapshot set.

expire_on

Timestamp when the snapshot expires.

示例

List all snapshots in snapshot set t1_snapshots:

SHOW SNAPSHOTS IN SNAPSHOT SET t1_snapshots;
Copy

Show the creation date and snapshot ID for the oldest snapshot in snapshot set t1_snapshots:

SHOW SNAPSHOTS IN SNAPSHOT SET t1_snapshots ->>
  SELECT "created_on", "snapshot_id" FROM $1
    ORDER BY "created_on" LIMIT 1;
Copy

Show the snapshot ID and the date and time when the final snapshot in snapshot set t1_snapshots will expire. This example presumes that the snapshot policy doesn't include a schedule, or the snapshot policy is suspended for the snapshot set, so that no new snapshots are being added to the snapshot set. You're just waiting for all the existing snapshots to expire so that you can drop the snapshot set.

SHOW SNAPSHOTS IN SNAPSHOT SET t1_snapshots ->>
  SELECT "expire_on", "snapshot_id" FROM $1
    ORDER BY "expire_on" DESC LIMIT 1;
Copy
语言: 中文