简体   繁体   English

Azure SQL Server 中大容量插入的权限问题

[英]Permission Issue on Bulk Insert in Azure SQL Server

User is getting below error while running bulk insert command in Azure SQL Server.用户在 Azure SQL Server 中运行批量插入命令时遇到以下错误。 I am using Azure SQL Server and not SQL Sever.我使用的是 Azure SQL Server 而不是 SQL Sever。 Most of the commands related to Bulk Insert grant permission is not working in Azure SQL Server.大多数与大容量插入授予权限相关的命令在 Azure SQL Server 中不起作用。

Error错误

You do not have permission to use the bulk load statement.

Commands Tried in Azure SQL Server to Add User在 Azure SQL Server 中尝试添加用户的命令

EXEC sp_addrolemember 'db_ddladmin', 'testuser'; 

ALTER SERVER ROLE [bulkadmin] ADD MEMBER testuser

GRANT ADMINISTER BULK OPERATIONS TO testuser

Error错误

Msg 40520, Level 16, State 1, Line 5
Securable class 'server' not supported in this version of SQL Server.

Your help is highly appreciated.非常感谢您的帮助。

In Azure SQL Database, grant ADMINISTER DATABASE BULK OPERATIONS to the principal in the context of the desire database:在 Azure SQL 数据库中,在所需数据库的上下文中将ADMINISTER DATABASE BULK OPERATIONS授予主体:

GRANT ADMINISTER DATABASE BULK OPERATIONS TO testuser;

The user will also need INSERT permissions on the target table.用户还需要对目标表的INSERT权限。 These Azure SQL Database permissions are detailed in the BULK INSERT documentation under the permissions section.这些 Azure SQL 数据库权限在权限部分下的BULK INSERT 文档中有详细说明

On Azure it works on tables in the database in question only.在 Azure 上,它仅适用于相关数据库中的表。 It does not work on temp tables.它不适用于临时表。 So if you are bulk loading in parallel and want to use temp tables, you are in a corner.因此,如果您并行批量加载并想要使用临时表,那么您就陷入了困境。

GRANT CONTROL to testuser 

nothing else is needed, just this to be executed in content DB (not master)不需要其他任何东西,只需在内容数据库中执行即可(不是主)

full steps完整步骤

in Master在硕士

CREATE LOGIN login1 WITH password='1231!#ASDF!a';

in content DB在内容数据库中

CREATE USER user1 FROM LOGIN login1;

GRANT CONTROL to user1; --(this is for bulk to work)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM