如何授予对 SQL Server 代理的访问权限以能够写入/修改系统文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14742324/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I grant access to SQL Server Agent to be able to write/modify system files?
提问by RJ.
I have a job that has a stored procedure that runs BCP to QUERYOUT some data.
我有一个工作,它有一个运行 BCP 来查询一些数据的存储过程。
If I run the QUERYOUT command by itself, it works.
如果我自己运行 QUERYOUT 命令,它会起作用。
However, if I try to run it in a JOB, it creates the file but "hangs" and the data is never put in the file. This hangs forever so I usually terminate the BCP.exe.
但是,如果我尝试在 JOB 中运行它,它会创建文件但“挂起”并且数据永远不会放入文件中。这将永远挂起,所以我通常会终止 BCP.exe。
My question is:
我的问题是:
How do I get a SQL job to run BCP to do a QUERYOUT and have the permissions to do so?
如何获得 SQL 作业以运行 BCP 以执行 QUERYOUT 并具有这样做的权限?
The QUERYOUT is going to the C:\ drive (so nothing fancy or anything).
QUERYOUT 将转到 C:\ 驱动器(所以没有什么花哨的或任何东西)。
This problem is driving me nuts and from reading online, it looks like the user that runs the jobs needs permissions to the folder. The folder isn't protected or anything.
这个问题让我发疯,从在线阅读来看,运行作业的用户似乎需要对该文件夹的权限。该文件夹不受保护或任何东西。
The owner of the SQL job is part of the SYS ADMIN group in SQL.
SQL 作业的所有者是 SQL 中 SYS ADMIN 组的一部分。
Any help would be greatly appreciated.
任何帮助将不胜感激。
回答by cha
check what user is assigned to SQL Server Agent service. Open services.msc, locate the SQL Server Agent and check Logon properties. There will be either a LocalSystem user (unlikely, based on what you have described) or another user.
检查分配给 SQL Server 代理服务的用户。打开 services.msc,找到 SQL Server 代理并检查登录属性。将有一个 LocalSystem 用户(不太可能,根据您的描述)或另一个用户。
Check that the user has "Write" access to the folder where you are trying to write the BCP dump.
检查用户是否对您尝试写入 BCP 转储的文件夹具有“写入”访问权限。