加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – SqlQueryNotificationStoredProcedure的错误填写

发布时间:2020-12-12 06:57:37 所属栏目:MsSql教程 来源:网络整理
导读:我的Sql Server日志正在快速填满错误消息,如下所示: The activated proc ‘[dbo].[SqlQueryNotificationStoredProcedure-b65a194e-e29f-4ba0-8f5a-79f0875bd609]’ running on queue ‘MyDatabase.dbo.SqlQueryNotificationService-b65a194e-e29f-4ba0-8f5a
我的Sql Server日志正在快速填满错误消息,如下所示:

The activated proc
‘[dbo].[SqlQueryNotificationStoredProcedure-b65a194e-e29f-4ba0-8f5a-79f0875bd609]’
running on queue
‘MyDatabase.dbo.SqlQueryNotificationService-b65a194e-e29f-4ba0-8f5a-79f0875bd609’ output the following: ‘Cannot execute
as the database principal because the
principal “dbo” does not exist,this
type of principal cannot be
impersonated,or you do not have
permission.’

这些消息引用的任何存储过程都不存在。

问题类似于here所述。该文章提到这个问题应该已经在2008 SP1被修复,但是我已经在运行SP1。

如果我运行以下命令…

select * from sys.service_queues

…我注意到有很多排队的项目,如SqlQueryNotificationService-f944d750-8530-4762-adcf-6948e8da991f。

但是如果我尝试使用以下命令杀死这些命令…

drop queue [SqlQueryNotificationService-78f5b757-45f0-4a4d-83f5-91e1d7e46294]

…我收到一条错误消息:队列’SqlQueryNotificationService-78f5b757-45f0-4a4d-83f5-91e1d7e46294’不能被删除,因为它绑定到一个或多个服务。

解决方法

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

你必须首先解决这个问题:

ALTER AUTHORIZATION ON DATABASE::<dbname> TO [sa];

现在,如果你想知道会发生什么,我推荐一些文章在我的博客:The Mysterious Notification和When it rains,it pours.在你的情况下,问题是两个折叠:

>导致数据库与孤立dbo的管理错误。这通常是由Windows SID从不相关的权限(即,不同的计算机上的本地帐户)创建的数据库的附加/还原的结果。
>在SqlDependency的起诉中的编码错误,因为代码在完成时省略调用Stop(),因此无法拆除SqlDependency临时基础设施。

通常,SqlDependency临时基础设施的激活过程将删除临时队列/服务/过程,但是在您的情况下,由于孤立的dbo废止所有事情,激活无法运行。

一旦修复了孤立的dbo(通过在我的帖子开始时运行ALTER),激活的程序将能够运行,它们将清除所有临时队列,服务和过程。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读