sql-server - 使用 SQL 身份验证时 SSIS 批量插入错误

标签 sql-server ssis bulkinsert ssis-2012

使用 SQL 身份验证时收到 SSIS 批量插入错误,而使用 Windows 身份验证时可以插入数据。

[Bulk Insert Task] Error: An error occurred with the following error message: "Cannot bulk load because the file "C:\BCP\extract_remove_ref.bcp" could not be opened. Operating system error code 3(failed to retrieve text for this error. Reason: 15105).".

最佳答案

使用 SQL Server 身份验证执行BULK INSERT 时,将按照 documentation 中的指定使用 SQL Server 服务所使用帐户的凭据。 。要解决此问题,请将 BULK INSERT 操作中使用的文件夹/文件的访问权限授予运行 SQL Server 服务的帐户。这可以通过 Windows 来完成,方法是右键单击文件夹/文件,然后转至属性> 安全> 编辑> 添加 并输入帐户名称。如果您找不到它,请确保在对象类型窗口中选择正确的帐户类型,并从位置窗口中选择正确的位置。如果您在查找帐户时遇到问题,请使用检查姓名选项。


更新 1 - 官方文档

引用以下官方文档:

向每服务 SID 授予文件系统权限

  1. Using Windows Explorer, navigate to the file system location where the database files are stored. Right-click the file system folder, and then click Properties.
  2. On the Security tab, click Edit, and then Add.
  3. In the Select Users, Computer, Service Account, or Groups dialog box, click Locations, at the top of the location list, select your computer name, and then click OK.
  4. In the Enter the object names to select box, type the name of the per-service SID name listed in the Books Online topic Configure Windows Service Accounts and Permissions. (For the Database Engine per service SID name, use NT SERVICE\MSSQLSERVER for a default instance, or NT SERVICE\MSSQL$InstanceName for a named instance.)
  5. Click Check Names to validate the entry. (If the validation fails, it might advise you that the name was not found. When you click OK, a Multiple Names Found dialog box appears. Now select the per-service SID name, either MSSQLSERVER or NT SERVICE\MSSQL$InstanceName, and then click OK. Click OK again to return to the Permissions dialog box.)
  6. In the Group or user names box, select the per-service SID name, and then in the Permissions for box, select the Allow check box for Full control.
  7. Click Apply, and then click OK twice to exit.

其他信息

关于sql-server - 使用 SQL 身份验证时 SSIS 批量插入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55223324/

相关文章:

asp.net - 两个应用程序如何使用单个 ASPState 数据库

sql-server - set @flag =1 和 set @@flag = 1 之间的区别

sql - 如何在 SQL Server 中使用 for 循环

c# - 批量 C# 数据表到 postgresql 表

mysql - postgresql 批量插入性能问题(相对于 mysql)

sql - 获取我在 Sql Server 中更新的行的 Id

sql-server-2005 - 为什么我在脚本任务连接器上收到对象引用未设置错误?

sql-server - 在 ssis 中动态加载 .xlsx 文件

c# - ssis vsta 脚本组件在编辑 VS2015 时打开速度慢

mysql - 将包含空值的列从 Excel 导入到 MYSQL Workbench 时出现问题