需要哪些数据库用户权限?
仅供参考:SQL Server 2005
我有一个数据库用户帐户 (user_web),它能够连接到我的数据库并在其中运行查询和存储过程。具体来说,我为用户授予了 db_datareader 和 db_datawriter 角色,并授予他们对其需要能够运行的特定存储过程的执行权限。
在其中一个存储过程中,我需要禁用触发器,然后在完成一些特定编辑后重新启用它。当我尝试与用户一起运行该存储过程时,出现以下错误:
Cannot find the object "TableName" because it does not exist or you do not have permissions.
TableName
是我尝试禁用和启用触发器的表。我的问题是我可以授予我的用户帐户以允许其成功运行存储过程的最少权限是多少。
FYI: SQL Server 2005
I have a database user account (user_web) that has the ability to connect to and run queries and stored procedures in my database. Specifically, I have given the user the db_datareader
and db_datawriter
roles as well as granted them execute permission on the specific stored procedures it needs to be able to run.
In one of the stored procedures, I need to disable a trigger then re-enable it after some specific edits are done. When I attempt to run that stored procedure with the user I get the following error:
Cannot find the object "TableName" because it does not exist or you do not have permissions.
TableName
is the table where I am attempting to disable and enable the trigger. My question is what is the least amount of permissions I can give to my user account that will allow it to successfully run the stored procedure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
用户“至少”需要对相关表的
ALTER
权限。请参阅:http://technet.microsoft.com/en-us/library/ ms182706.aspxThe user will "at a minimum" require
ALTER
permissions on the table in question. See: http://technet.microsoft.com/en-us/library/ms182706.aspx我不会授予用户对表的
ALTER
权限(这可能是一个安全问题),而是让该特定存储过程作为具有这些权限的其他用户运行。使用 EXECUTE AS 语法来完成此操作。http://msdn.microsoft.com/en-us/library/ms188354。 ASPX
Rather than grant the user
ALTER
permissions on the table, which could be a security issue, I'd have that particular stored procedure run as a different user that does have those permissions. Use theEXECUTE AS
syntax to accomplish this.http://msdn.microsoft.com/en-us/library/ms188354.aspx