SHOW SNAPSHOT POLICIES

Lists all the snapshot policies in your account for which you have access privileges.

另请参阅:

CREATE SNAPSHOT POLICY, ALTER SNAPSHOT POLICY, DROP SNAPSHOT POLICY

语法

SHOW SNAPSHOT POLICIES
   [ LIKE '<pattern>' ]
   [ IN { ACCOUNT | DATABASE | DATABASE <db_name> | SCHEMA | SCHEMA <schema_name> } ]
Copy

参数

LIKE 'pattern'

(可选)按对象名称筛选命令输出。筛选器使用 不区分大小写 的模式匹配,并支持 SQL 通配符(%_)。

例如,以下模式返回 相同的 结果:

... LIKE '%testing%' ...
... LIKE '%TESTING%' ...

. 默认:无值(不对输出应用筛选)。

[ IN { ACCOUNT | DATABASE | DATABASE db_name | SCHEMA | SCHEMA schema_name } ]

如果您指定关键字 ACCOUNT,则该命令将检索当前账户的所有数据库中所有架构的记录。

如果您指定关键字 DATABASE,那么:

  • 如果指定 db_name,则该命令将检索指定数据库的所有架构的记录。

  • If you don't specify a db_name, then:

    • 如果存在当前数据库,则该命令将检索当前数据库中所有架构的记录。

    • 如果当前没有数据库,则该命令将检索账户中所有数据库和架构的记录。

如果您指定关键字 SCHEMA,那么:

  • If you specify a qualified schema name (for example, my_database.my_schema), then the command retrieves records for the specified database and schema.

  • 如果您指定了未限定的 schema_name,那么:

    • 如果存在当前数据库,则该命令将检索当前数据库中指定架构的记录。

    • 如果当前没有数据库,则该命令会显示错误 SQL compilation error: Object does not exist, or operation cannot be performed

  • If you don't specify a schema_name, then:

    • 如果当前有数据库,那么:

      • 如果当前存在架构,则该命令将检索当前数据库中当前架构的记录。

      • 如果不存在当前架构,则该命令将检索当前数据库中所有架构的记录。

    • 如果当前没有数据库,则该命令将检索账户中所有数据库和所有架构的记录。

使用说明

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

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

To determine whether a snapshot policy is associated with any snapshot sets, use the SHOW SNAPSHOT SETS command.

备注

The snapshot policy is an object that's inside a specific schema and database. Therefore, the policy gets replicated, dropped or undropped, and so on, when those operations are performed on the schema and database that contain it. If you can't drop the snapshot policy because it's associated with any snapshot sets, then you also can't drop the schema or database containing the policy.

输出

描述

created_on

Timestamp snapshot policy was created.

name

Name of snapshot policy.

database_name

Name of database that contains the snapshot policy.

schema_name

Name of schema that contains the snapshot policy.

owner

Name of the role with the OWNERSHIP privilege on the snapshot policy.

comment

Comment for snapshot policy.

schedule

Schedule for snapshot creation.

expire_after_days

Number of days after snapshot creation when snapshot expires.

has_retention_lock

Indicates whether the policy includes a retention lock.

Y if policy has retention lock; N otherwise.

For more information, see Retention lock.

owner

Name of the role with the OWNERSHIP privilege on the snapshot set.

owner_role_type

Type of role with the OWNERSHIP privilege on the snapshot policy.

示例

List all snapshot policies you have privileges for in the current account:

SHOW SNAPSHOT POLICIES IN ACCOUNT;
Copy
语言: 中文