如何找出 SQL 存储过程以什么用户身份访问网络共享?
我被要求找出程序失败的原因。我已经将其追溯到 SQL 存储过程。程序传入一个文件名,该文件名是st.程序。大概尝试阅读。
但是,SQL Server 返回一个错误,指示它无法访问该文件,因为访问被拒绝。
我的连接字符串显示 Integrated Security=SSPI;
。我确信我登录来运行该程序的帐户有权访问该文件。
如何确定 SQL Server 使用哪个用户帐户来访问该文件?
I've been asked to find out why a program is failing. I've traced it to a SQL stored procedure. The program passes in the name of a file that the st. proc. presumably tries to read.
However, the SQL server is returning an error indicating that it cannot access the file because access is denied.
My connection string says Integrated Security=SSPI;
. I know for sure that the account that I'm logged in with to run the program has access to the file.
How can I find out for sure what user account the SQL server is using to access the file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Windows 进程监视器是一个很好的起点。
http://technet.microsoft.com/en-us/sysinternals/bb896645。 aspx
出于对什么版本的 SQL 的兴趣,我们是在谈论 CLR 还是只是普通的存储过程?
The Windows Process Monitor is a good place to start.
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
Out of interest what version of SQL, are we talking CLR or just plain ol' sprocs?
它将使用 SQL Server 服务帐户来访问文件系统。
It will be using the SQL Server service account to access the file system.
您可以查看这篇文章。用户
USER_NAME
获取登录用户的 SQL 用户名。然而,听起来问题可能是文件的权限,而不是数据库的权限。您需要检查文件和目录以及数据库上是否设置了适当的权限。
You can look at this article. User
USER_NAME
to get the SQL Username for the logged in user.However, it sounds like the problem might be permissions with the FILE, not with the DB. You'll want to check that the appropraite permissions are set on the File and Directory as well as on the DB.