G.S*_*ith 6 sql-server service-broker sql-server-2012 sql-server-2014
我主要是为了社区意识而发布此内容,但如果您认为除了我们正在解决的问题编码之外还有其他解决方案,请随时提供反馈。从我在这里提交的错误中交叉发布:https ://feedback.azure.com/forums/908035-sql-server/suggestions/37351609-sql-server-2012-service-broker-ssbdt-spam-endi
我们在某些 SQL 2014 和 2017 实例上遇到了问题,其中 ERRORLOG 重复发布如下消息:
2019-03-20 08:36:13.87 spid26s SSBDT:注册期间的对话定时器删除(did:4334D97F-9C96-47BC-AB1C-B9BE5888F89A:Initiator,OpType:CloseDialog OpResult:Null)
我研究了一下,一致认为微软表示这只是调试日志记录(https://social.msdn.microsoft.com/Forums/en-US/86b8a5c8-a882-496e-a4c4-99a5bbf2f935/ssbdt-dialog-timer-delete- during-dispatch-with-sql-server-2012-sp3?forum=sqlsetupandupgrade)。但是,我们的系统使用此日志记录间歇性地膨胀 ERRORLOG 并没有改变。经过调查,我发现了以下复制案例:
当满足前 4 个要求并且每次发生 5 个时,它都会向 ERRORLOG 记录一条消息,类似于我上面发布的消息。这似乎发生在 SQL Server 重新启动之前。我附上了在新数据库中重新创建此示例的 SQL。在我们的例子中,我们获得了一个目标服务的会话句柄,但如果该服务不存在,我们就没有 NULL 处理并尝试发送消息。这个问题在 SQL2008R2 中不存在。我觉得对于给定的复制步骤,这应该被重新考虑为 SQL Server 中的错误。就我们而言,我们正在向代码中添加 NULL 处理。
编辑:我在 SQL2014 SP3 系统上观察到,即使您从未发送过 NULL 对话,ERRORLOG 中的此 SSBDT 对话消息也会在结束对话时发生。我不确定如何或为什么会出现这种情况,即使在您创建和结束对话时启动后也会立即发生。以前在其他测试系统上不需要。
产生这个问题的SQL:
-- 1. Turn on Trace Flag 3605. Required to generate the error
DBCC TRACEON(3605,-1)
GO
-- Creating a test database
IF EXISTS (SELECT name FROM sys.databases WHERE name = 'source')
DROP DATABASE [source]
GO
CREATE DATABASE [source];
GO
USE [source];
GO
-- in case broker isn't enabled by default on a new database on this instance
ALTER DATABASE [source] SET NEW_BROKER
GO
-- creating a source queue/service
CREATE QUEUE [source_queue];
GO
CREATE SERVICE [source_service] ON QUEUE [source_queue];
GO
-- creating a target queue/service
CREATE QUEUE [target_queue];
GO
CREATE SERVICE [target_service] ON QUEUE [target_queue];
GO
-- creating a dialog between them
DECLARE @h UNIQUEIDENTIFIER;
BEGIN DIALOG CONVERSATION @h
FROM SERVICE [source_service]
TO SERVICE N'target_service'
WITH ENCRYPTION = OFF;
GO
-- sending a message to nowhere: note this does NOT interact with the dialog or queues/services we generated. It simply is a message to nothing at all. This generates an error that the conversation handle is missing.
SEND ON CONVERSATION NULL;
GO
-- ending the conversation between those two services/queues. Error before that logs to ERRORLOG to stamp and after, to demonstrate that this action is the one causing the debug spam.
DECLARE @h UNIQUEIDENTIFIER
SELECT @h = conversation_handle
FROM [source].sys.conversation_endpoints;
DECLARE @error NVARCHAR(100)
SET @error = 'Before the conversation end'
RAISERROR(@error,16,1) WITH LOG
END CONVERSATION @h WITH CLEANUP
GO
DECLARE @error NVARCHAR(100)
SET @error = 'After the conversation end'
RAISERROR(@error,16,1) WITH LOG
GO
USE [master];
GO
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
599 次 |
最近记录: |