你的位置:首页 > 软件开发 > 数据库 > Cannot execute as the database principal because the principal guest does not exist, this type of principal cannot be impersonated, or you do not have permission.

Cannot execute as the database principal because the principal guest does not exist, this type of principal cannot be impersonated, or you do not have permission.

发布时间:2016-10-17 13:00:29
今天遇到这样一个问题:一个系统的作业需要给系统Support人员开放SQL Agent下作业的查看、执行权限。数据库版本为SQL Server 2014 SP2,给这个系统Support人员的NT账号授予msdb数据库下面权限后: 该系统Support人员反馈在 ...

今天遇到这样一个问题:一个系统的作业需要给系统Support人员开放SQL Agent下作业的查看、执行权限。数据库版本为Server.aspx' target='_blank'>SQL Server 2014 SP2,给这个系统Support人员的NT账号授予msdb数据库下面权限后:

 

Cannot execute as the database principal because the principal guest does not exist, this type of principal cannot be impersonated, or you do not have permission.

 

该系统Support人员反馈在双击查看该作业时报下面错误。于是我测试,验证了一下这个权限是否OK,

 

Cannot execute as the database principal because the principal guest does not exist, this type of principal cannot be impersonated, or you do not have permission.

 

我测试的时候使用的是Microsoft SQL Server Management Sutdio 2014,发现不会出现这个错误。 后面我又继续测试了一下Microsoft SQL Server Management Sutdio 2008,发现使用这个版本确实会出现这个错误,Microsoft SQL Server Management Sutdio 2008版本如下所示:

 

Cannot execute as the database principal because the principal guest does not exist, this type of principal cannot be impersonated, or you do not have permission.

 

于是我用SQL Profile跟踪了一下,双击作业操作时执行的SQL语句,如下所示

 

Cannot execute as the database principal because the principal guest does not exist, this type of principal cannot be impersonated, or you do not have permission.

 

在执行下面SQL时,出现错误,可以将该SQL取出,在Microsoft SQL Server Management Sutdio 里面执行。

 

exec master.dbo.sp_MSdbuserpriv N'serv'

Cannot execute as the database principal because the principal guest does not exist, this type of principal cannot be impersonated, or you do not have permission.

 

解决这个问题也很简单,只需要给这个NT账号,授予master数据库下面的public角色即可解决问题。


原标题:Cannot execute as the database principal because the principal guest does not exist, this type of principal cannot be impersonated, or you do not have permission.

关键词:ip

ip
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。