启用非 ACCOUNTADMIN 角色执行数据共享任务

本主题列出了执行与共享相关的 SQL 操作所需的最低权限。

默认情况下,创建和管理共享所需的权限仅授予 ACCOUNTADMIN 角色,以确保只有账户管理员才能执行这些任务。但是,也可以将权限授予其他角色,从而将任务委派给账户中的其他用户。

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.

Note

If you grant sharing privileges to other users in the account, make sure that the user profiles for those other users includes a first name, last name, and an email address. To modify the user profile in Snowsight, see Add user details to your user profile.

数据提供商

Data providers can choose either of the following options to add objects to a share:

  • Option 1: Create a database role in a database, grant privileges on objects to the database role, and then grant the database role to the share.
  • 选项 2: 将数据库和数据库对象的权限直接授予共享。

For more information on these options, see How to share database objects.

在数据提供商或数据使用者账户中,创建和管理共享所需的最低权限,取决于使用的选项。

Option 1:
操作权限对象备注
创建共享。CREATE SHARE账户只有 ACCOUNTADMIN 角色默认具有此权限。可以根据需要将该权限授予其他角色。
在数据库中创建数据库角色。CREATE DATABASE ROLE数据库仅数据库所有者角色(即具有 OWNERSHIP 数据库权限)默认具有此权限。可以根据需要将该权限授予其他角色。
Option 2:
ActionPrivilegeObjectNotes
Create shares.CREATE SHAREAccountOnly the ACCOUNTADMIN role has this privilege by default. The privilege can be granted to additional roles as needed.
Grant or revoke privileges on objects to or from a share.OWNERSHIPShare

该角色还必须至少对具有授予选项的数据库对象具有以下权限:

  • 数据库上的 USAGE
  • 架构上的 USAGE
  • 所有表、外部表、安全视图或安全物化视图上的 SELECT
  • 安全 UDFs 上的 USAGE

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.

Attention

向其他角色授予 CREATE SHARE,使管理共享更加灵活,而且还允许具有这些角色的用户向其他账户公开他们拥有(或拥有必要权限的)的对象。如果要共享包含敏感数据或专有数据的账户中的数据,这一点尤其需要注意。

在将 CREATE SHARE 授予其他角色之前,请注意这一点。

阻止访问共享中的对象

Access to objects in a share can be blocked by either the role that owns the share or the role that owns the objects:

  • 如果您的角色拥有共享,可以通过撤销共享中对象的权限来阻止访问。
  • If your role does not own the share, but owns the objects in the share, you can block access by revoking the USAGE or SELECT privileges with CASCADE on the objects from the share owner.

Note

Ownership of a share, as well as the objects in the share, may be either through a direct grant to the role or inherited from a lower-level role in the role hierarchy. For more details, see Role hierarchy and privilege inheritance.

同一角色可以拥有共享以及共享中的对象。

数据使用者

在使用者账户中,全局 IMPORT SHARE 权限允许查看与账户共享的入站共享。如果还向该角色授予了全局 CREATE DATABASE 权限,则该权限还允许从入站共享创建数据库。

IMPORT SHARE 权限

如果授予角色 IMPORT SHARE 权限,具有该角色的任何用户都可以执行以下任务:

  • 查看所有 INBOUND 共享(由提供商账户共享)。
  • 查看角色拥有的所有 OUTBOUND 共享。
  • 从入站共享创建数据库(如果还授予了角色全局 CREATE DATABASE 权限)

向其他角色授予权限

To grant the global IMPORT SHARE privilege to a non-ACCOUNTADMIN role in a consumer account, use the ACCOUNTADMIN role and the GRANT <privileges> … TO ROLE command.

例如,向 SYSADMIN 角色授予权限:

USE ROLE ACCOUNTADMIN;

GRANT IMPORT SHARE ON ACCOUNT TO SYSADMIN;