How to enable bulk permission in SQL Server

ia2d9nvy  于 2023-10-15  发布在  SQL Server
关注(0)|答案(5)|浏览(136)

I am trying to insert images using "bulk" into SQL Server 2012. But, am ending up with the error message stating tha:
Msg 4834, Level 16, State 1, Line 2 You do not have permission to use the bulk load statement.

I have "sysadmin" access.

ix0qys7i

ix0qys7i1#

Try GRANT ADMINISTER BULK OPERATIONS TO [server_login] . It is a server level permission, not a database level. This has fixed a similar issue for me in that past (using OPENROWSET I believe).

kcwpcxri

kcwpcxri2#

Try this:

USE master;

GO;
 
GRANT ADMINISTER BULK OPERATIONS TO shira;
50pmv0ei

50pmv0ei3#

Note that the accepted answer or either of these two solutions work for Windows only.

GRANT ADMINISTER BULK OPERATIONS TO [login_name];
-- OR
ALTER SERVER ROLE [bulkadmin] ADD MEMBER [login_name];

If you run any of them on SQL Server based on a linux machine, you will get these errors:

Msg 16202, Level 15, State 1, Line 1
Keyword or statement option 'bulkadmin' is not supported on the 'Linux' platform.
Msg 16202, Level 15, State 3, Line 1
Keyword or statement option 'ADMINISTER BULK OPERATIONS' is not supported on the 'Linux' platform.

Check the docs.

Requires INSERT and ADMINISTER BULK OPERATIONS permissions. In Azure SQL Database, INSERT and ADMINISTER DATABASE BULK OPERATIONS permissions are required. ADMINISTER BULK OPERATIONS permissions or the bulkadmin role is not supported for SQL Server on Linux. Only the sysadmin can perform bulk inserts for SQL Server on Linux.

Solution for Linux

ALTER SERVER ROLE [sysadmin] ADD MEMBER [login_name];
p5cysglq

p5cysglq4#

If you get an error saying "Cannot Bulk load file because you don't have access right"

First make sure the path and file name you have given are correct.

then try giving the bulkadmin role to the user. To do so follow the steps :- In Object Explorer -> Security -> Logins -> Select the user (right click) -> Properties -> Server Roles -> check the bulkadmin checkbox -> OK.

This worked for me.

brccelvz

brccelvz5#

SQL Server may also return this error if the service account does not have permission to read the file being imported. Ensure that the service account has read access to the file location. For example:

icacls D:\ImportFiles /Grant "NT Service\MSSQLServer":(OI)(CI)R

相关问题