Quantcast
Channel: SQL Service Broker forum
Viewing all 461 articles
Browse latest View live

Permissions for SQLDependency

$
0
0

Hi all,

I have a web service that uses ASP.NET cache and SQLDependency to invalidate the cache.

The command used for SQLDependency relies on a Stored Procedure.

The problem is that the user that the web service uses to arrive on the DB is a readonly user.

So, a SQLException is raised on subscription because the user hasn't CREATE PROCEDURE rights.

How can I solve giving the user minimum permissions?


What does this transmission_status mean?

$
0
0

Noticed several older messages appear to be stuck in the sys.transmission_queue with a transmission_status of 

"Service Broker received an END CONVERSATION message on this conversation. Service Broker will not transmit the message; it will be held until the application ends the conversation."

We used to end the conversation in the initiator sp but have since moved the end conversation logic to the receiver / activation sp.  How do you clean these stuck messages in the transmission queue?

Sql 2014

MSDB Size Grown 159 GB suddenly after upgrading sql 2014 to Service pack 2 , CU10 in cluster

$
0
0

hi , 

in my live server sql 2014 sp1 in cluster server the size was around 10 GB , we didnt set the initial size of msdb.

where in after applying service pack to SP2 CU10 , the msdb grown after restart to 159 GB , I am shocked why it grown . 

seen the tables whose sizes are minimal and finally found an system table shown below is grown such an extent. 

object_id

obj

type

total_rows

total_size

68

sys.sysxmitqueue

S

58425635

153572.94

910626287

dbo.sysmail_mailitems

U

53135

2564.88

1182627256

dbo.sysmail_attachments

U

517

200.69

571149080

dbo.sysmaintplan_logdetail

U

223

9.28

Can you please help to know is some thing went wrong is the reason why it has grown to such extent. and what is the usage of that table ? any ways to minimize the size of the database . 

please suggest and help


hemadri

SqlDependency Permission issue

$
0
0

I am getting the following error while staring the sqldependency

Cannot find the specified user 'owner'. Cannot find the queue 'SqlQueryNotificationService-dfb11997-c69e-4e3b-a640-29cdf4c3e9fa', because it does not exist or you do not have permission. Invalid object name 'SqlQueryNotificationService-dfb11997-c69e-4e3b-a640-29cdf4c3e9fa'.

I already gave the following permissions. Not sure what other permissions to give to the sql role/user. Appreciate your time and help

GRANT CREATE PROCEDURE to [SqlUser] 
GRANT CREATE QUEUE to [SqlUser]
GRANT CREATE SERVICE to [SqlUser]
GRANT REFERENCES on 
CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification]
 to [SqlUser] 
GRANT VIEW DEFINITION TO [SqlUser] 
GRANT SELECT to [SqlUser] 
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [SqlUser] 
GRANT RECEIVE ON QueryNotificationErrorsQueue TO [SqlUser]
GRANT ALTER ON SCHEMA::dbo TO [SqlUser]
GRANT CONTROL ON SCHEMA::[dbo] TO [SqlUser]; 
GRANT IMPERSONATE ON USER::DBO TO [SqlUser];
ALTER USER [sqluser] WITH DEFAULT_SCHEMA=[SqlUser]
GO

How can I assure that the broker_guid is unique

$
0
0

Dear colleagues,

We are using the broker technology to perform some asynchronous stored procedure calls. We build and sell an ERP product. We ship a StartDB for new customers to quickly setup an environment with common settings. Also, customers often make backups of their production database and load this database in a test database.

If a customer needs more than one production environment, loading the same StartDB twice will result in two databases with the same service_broker_guid. The same problem occurs when the test database is loaded from the production database backup. I now you can solve this by executing the statement below.

ALTER DATABASE <DBname> SET NEW_BROKER WITH ROLLBACK IMMEDIATE;

Is there a way I can automatically run the statement above after a restore operation? Some of our customers do not have a DBA who nows what to do. What is worse, the broker will be disabled after the restore and everything seems to work fine. If you do not know where to look, nobody even notices that the async procs are never executed.

Thank you for your help.

How to prioritize service broker queues via SQL resource governor?

$
0
0

It would be immensely helpful if we could prioritize service broker queue resources (cpu, memory, io).  Is this possible using SQL resource governor?  If not, where is the proper place to suggest this as a feature for future SQL server?

Currently on sql 2014 enterprise

Error 15517

$
0
0
please need help ..

this the wrong message shown in my log

An exception occurred while enqueueing a message in the target queue. Error: 15517<c/> State: 1. Cannot execute as the database principal because the principal "dbo" does not exist<c/> this type of principal cannot be impersonated<c/> or you do not have permission.

MCP MCSA MCSE MCT

SQL Server Error logs are growing in server and disk getting full.

$
0
0

I could see following error was caused for the SQL error logs to grow 

Error: 28005, Severity: 16, State: 2.

An exception occurred while enqueueing a message in the target queue. 
Error: 15404, State: 11. Could not obtain information about Windows NT group/user 'ABC\admin', error code 0x534.

How can I know what exact is causing for this error?

what is the resolution?


Endpoint key exchange algorithm

$
0
0

Hi!

When establishing a connection between two endpoints using SQL Service Broker using certificates and using AES encryption. 

What algorithm is used for the key exchange?

Orphaned Conversation Handle Remains After Ending the Conversation From Both Sides

$
0
0

I am try to implement a simple proof-of-concept of SB, and I am having trouble understanding why conversation handles are building up despite the fact that I am not implementing the "fire-and-forget" anti-pattern and I am ending the conversation twice.  The TSQL below can be used to demonstrate the issue.  Any assistance or advice would be greatly appreciated.

use master
GO
IF EXISTS(select * from sys.databases where name = 'TestServiceBroker')
	DROP database TestServiceBroker
GO
CREATE DATABASE TestServiceBroker
ALTER DATABASE TestServiceBroker SET ENABLE_BROKER
GO
use TestServiceBroker
GO
CREATE MESSAGE TYPE TestMessage VALIDATION = NONE
CREATE CONTRACT TestMessageContract (TestMessage SENT BY INITIATOR)
CREATE QUEUE TargetQueue
CREATE QUEUE InitiatorQueue
CREATE SERVICE [TargetService] ON QUEUE TargetQueue ([TestMessageContract])
CREATE SERVICE [InitiatorService] ON QUEUE InitiatorQueue ([TestMessageContract])
GO

/*Start a dialog*/
DECLARE @dialog_handle uniqueidentifier;

BEGIN DIALOG CONVERSATION @dialog_handle
   FROM SERVICE [InitiatorService]
   TO SERVICE 'TargetService'
   ON CONTRACT [TestMessageContract]
   WITH ENCRYPTION = OFF;

/*Send a message on that dialog*/
SEND ON CONVERSATION @dialog_handle
	MESSAGE TYPE TestMessage;
GO

/*Receive the message on the target*/
DECLARE @dialog_handle uniqueidentifier;
RECEIVE top(1) @dialog_handle = conversation_handle FROM TargetQueue;

/*End the dialog from target*/
END CONVERSATION @dialog_handle;
GO

/*Receive the end dialog request on the initiator*/
DECLARE @dialog_handle uniqueidentifier;
RECEIVE top(1) @dialog_handle = conversation_handle FROM InitiatorQueue;	

/*End the dialog from initiator*/
END CONVERSATION @dialog_handle;
GO

/*The dialog should now be closed cleanly.  Why is there still an endpoint listed here???!!!*/
select conversation_handle as 'Orphaned Conversation Handle'
from sys.conversation_endpoints;

The Service Broker protocol transport is not available -sERVICE ENABLED ON db

$
0
0

Hi Guys,

I get error The Service Broker protocol transport is not available. error; when i am using inert/update trigger as cross server table update/insert.

Did check the DB service broker is enabled on the DB. used below query.

select name,is_broker_enabled,service_broker_guid from sys.databases
where is_broker_enabled=1

MYDB is listed in the results.

Another other pointers for troubleshooting above error. I checked i am using same TCP port mentioned on SQL server configuration 1433.

CREATE ROUTE ReplData_Route_Dest
WITH SERVICE_NAME='ReplData_Dest_Service',
BROKER_INSTANCE='566C7F7A-9373-460A-8BCC-5C1FD4BF49C9',
ADDRESS='tcp://xyz.xyz.com:1433'

Regards,

Navin


Navin.D http://dnavin.wordpress.com

SQL Failure I fail to diagnose seemingly caused by the service Broker

$
0
0

HI !

I have been using the service broker for nearly a year to trigger/parallelize some StoredProcedures / RServices machine learning tasks.

For a few days now, the workflow has been broken with these msg in the log

The activated proc 'procname' running on queue 'queuename' output the following:  'A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a Hotfix from Technical Support.'

There are two error codes issued

Error: 3624, Severity: 20, State: 1.

A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a Hotfix from Technical Support.

AND Error: 17066, Severity: 16, State: 1.

SQL Server Assertion: File: <tmpilb.cpp>, line=1816 Failed Assertion = 'SOS_Task::GetCurrent() == m_pTaskMain'. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or restart the server to ensure in-memory data structures are not corrupted.

* Location:     tmpilb.cpp:1816 * Expression:     SOS_Task::GetCurrent() == m_pTaskMain

We found and installed a related update for SQL2016 SP1 https://support.microsoft.com/fr-lu/help/4058565 with no change in behavior.

(Found this page too but it's for SQL2012 https://support.microsoft.com/fr-ma/help/3125526/fix-you-receive-error-messages-when-you-run-a-query-that-uses-tempdb-i so obviously not a solution for us)

DBCC CHECKDB returns no error

Thanks for your help.

SCCM service broker

$
0
0

Primary site server and the replica of the primary site server are connected via AlwaysON.

AlwaysOn works fine. Failover , Failback everything is fine.

Once after alwaysON is enabled, getting the bellow message in SQL error log.

Message
Service Broker login attempt failed with error: 'A previously existing connection with the same peer was detected during connection handshake. This connection lost the arbitration and it will be closed. All traffic will be redirected to the previously existing connection. This is an informational message only. No user action is required. State 80.'.  [CLIENT: 10.168.45.140]

Can anyone please let me know what this message means? as the SCCM team is not ready to move forward without resolving this error.

Many thanks for all your help in advance.

Handling IIS Application Pool Recycles and Service Broker marks it as poisoned

$
0
0

We are using a pair of Service Broker Initiator-Target queues to break a transaction and to distribute messages so a second system. All is well under normal circumstances, the Initiator receives a message and passes it on to the Target which then calls a SP with an embeded SQLCLR which then publishes the message to the final system via a REST API call.

The REST API is hosted by IIS, and every now and then IIS refreshes the Application Pool. If there is a period of low message activity then this is managed by the Target queue however if there is a period of high activity the Target queue receives a series of 500 responses from IIS and disables the queue marking the IIS endpoint as poisoned.

Poisoned queues are a very useful and we would prefer not to override this SB setting, how else then can we manage this occasional IIS 'downtime' which can last two or three minutes?

Thanks

Service Broker External Activator Installation on a cluster

$
0
0

I have developed and tested a Sql Server 2012 Service Broker/Service Broker External Activator application which I am struggling to deploy.

Installation of the Service Broker External Activator appears to work without error, but

i)  The service does not appear in the services.msc console

ii) Activation is not occurring - i.e. no sign of activity on the EATrace log.

iii) I can see no event logs that indicate any problem.

The only significant difference from the development and test environments that I know of is that the production environment is a cluster.  I had hoped that I could run this item on a single node and then consider scaling up at a later date.

What should be my next step?


message is remaining inside queue even if evnt notification is present and service is also running , in service broker external activator

$
0
0

Hi,

I doing work on service broker external activator, all are working fine , but if i insert data , its is remaining in thq queue, even when the event notification is present , given grant permission , config , app.config everything is correct.

if i turn off service , end task , then turn on service , then it will work fine , queue will be cleared . but then when i insert data again , its remaining in queue. 

can anyone help...

Thanks in advance

Server Event Notifications Not Working - SQL Server 2016

$
0
0

I am attempting to setup AUDIT_LOGIN and AUDIT_LOGIN_FAILED server events to capture login activity for one of my SQL Server 2016 SP1 CU8 instances, but the server event notificaitons do not seem to be firing at all.  All of the objects get created with no issues, but I am not seeing any messages go into the service broker queue when these events occur.

I have implemented this on hundreds of other servers, including some on the exact same version/patch level with no issues whatsoever.

I have ran a trace using Profiler to verify that the events are occurring and that no errors are being thrown by the service broker queue's activation procedure.  I have also renamed my activation procedure to an invalid name to see if any errors get thrown or if any messages get stuck in the service broker queue, but don't see anything.

This really smells like a bug to me, but wondering if anyone has any other ideas to troubleshoot this.  Appreciate any help on this.

Here is the script I used to create the server events and necessary service broker objects (table schemas, activation procedure, and service broker GUID redacted):

ALTER DATABASE [Audit] SET ENABLE_BROKER;

CREATE QUEUE [dbo].[NotifyQueue]
WITH STATUS = ON, RETENTION = OFF, 
ACTIVATION (STATUS = ON, PROCEDURE_NAME = [dbo].[usp_Process_Audit_Login], MAX_QUEUE_READERS = 5, EXECUTE AS N'dbo'), 
POISON_MESSAGE_HANDLING (STATUS = ON)
ON [PRIMARY];
GO

CREATE SERVICE [Notify] AUTHORIZATION [dbo] ON QUEUE [dbo].[NotifyQueue] ([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification]);
GO

CREATE EVENT NOTIFICATION SendLoginNotification ON SERVER WITH FAN_IN FOR AUDIT_LOGIN, AUDIT_LOGIN_FAILED TO SERVICE 'Notify', '<service broker guid for Audit database>'
GO 

Thanks,

Ryan



Service Broker External Activator Aborting When Runtime Checkpointing

$
0
0

Windows Server 2016 Standard fully patched 

We have been using Service Broker External Activator for a few years now with few problems but are having a recurring problem in the past week where the service will abort with the following error in EATrace.log:

18/07/2018 09:59:45 EXCEPTION
ERROR = 90, Internal exceptions have occurred when External Activator is runtime checkpointing.
18/07/2018 09:59:45 EXCEPTIONDETAILS Inner Exception:
18/07/2018 09:59:45 EXCEPTIONDETAILS System.IO.IOException: Cannot create a file when that file already exists.
18/07/2018 09:59:45 EXCEPTIONDETAILS 
18/07/2018 09:59:45 EXCEPTIONDETAILS    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
18/07/2018 09:59:45 EXCEPTIONDETAILS    at System.IO.File.Move(String sourceFileName, String destFileName)
18/07/2018 09:59:45 EXCEPTIONDETAILS    at ExternalActivator.LogManager.SaveRecoveryContext(LogRecoveryContext recoveryContext)
18/07/2018 09:59:45 EXCEPTIONDETAILS    at ExternalActivator.LogManager.Checkpoint(LogRecoveryContext recoveryContext)
18/07/2018 09:59:45 EXCEPTIONDETAILS    at ExternalActivator.LogManager.Log(LogRecord recoveryLogRec)
18/07/2018 09:59:45 EXCEPTIONDETAILS    at ExternalActivator.ApplicationMonitor.OnProcessExited(ProcessMonitor processMonitor)
18/07/2018 09:59:45 EXCEPTIONDETAILS    at ExternalActivator.ProcessMonitor.NotifySubscriber()
18/07/2018 09:59:45 EXCEPTIONDETAILS    at ExternalActivator.ProcessMonitor.OnProcessExited(Object a, EventArgs b)

When checking the log folder after this has occurred I can see that the EARecovery.rlog file has been deleted and in it's place is an EARecovery_temp.rlog file. I assume that the File.Move call is to rename that to the original name. Nothing new has been installed on this server save for the usual Windows updates. 

This started happening on the 16th July and has happened at least once a day since at various times. It does seem to be checkpointing a lot more than I expected though as can be shown from the following snippet from the log:


23/07/2018 11:40:09 VERBOSE Received event notification for [UKSQL4].[Rubicon].[Brkr].[PDFServiceTargetQueue].
23/07/2018 11:40:09 VERBOSE Application process C:\Program Files\Company\Company.Rubicon.ServiceBroker.PDFService\Company.Rubicon.ServiceBroker.PDFService.exe was created: id = 55036.
23/07/2018 11:40:14 VERBOSE Received event notification for [UKSQL4].[Rubicon].[Brkr].[EmailTargetQueue].
23/07/2018 11:40:14 VERBOSE Application process C:\Program Files\Company\Company.Rubicon.ServiceBroker.Emailer\Company.Rubicon.ServiceBroker.Emailer.exe was created: id = 5544.
23/07/2018 11:40:17 VERBOSE Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
23/07/2018 11:40:17 VERBOSE Checkpointing recovery log completed.
23/07/2018 11:40:17 VERBOSE Application process id = 55036 has exited: exit code = 0, exit time = 7/23/2018 11:40:17 AM.
23/07/2018 11:40:18 VERBOSE Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
23/07/2018 11:40:18 VERBOSE Checkpointing recovery log completed.
23/07/2018 11:40:18 VERBOSE Application process id = 5544 has exited: exit code = 0, exit time = 7/23/2018 11:40:18 AM.
23/07/2018 11:40:29 VERBOSE Received event notification for [UKSQL4].[Rubicon].[Brkr].[EmailTargetQueue].
23/07/2018 11:40:29 VERBOSE Application process C:\Program Files\Company\Company.Rubicon.ServiceBroker.Emailer\Company.Rubicon.ServiceBroker.Emailer.exe was created: id = 56352.
23/07/2018 11:40:33 VERBOSE Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
23/07/2018 11:40:33 VERBOSE Checkpointing recovery log completed.
23/07/2018 11:40:33 VERBOSE Application process id = 56352 has exited: exit code = 0, exit time = 7/23/2018 11:40:33 AM.
23/07/2018 11:41:27 VERBOSE Received event notification for [UKSQL4].[Rubicon].[Brkr].[EmailTargetQueue].
23/07/2018 11:41:27 VERBOSE Application process C:\Program Files\Company\Company.Rubicon.ServiceBroker.Emailer\Company.Rubicon.ServiceBroker.Emailer.exe was created: id = 56872.
23/07/2018 11:41:31 VERBOSE Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
23/07/2018 11:41:31 VERBOSE Checkpointing recovery log completed.
23/07/2018 11:41:31 VERBOSE Application process id = 56872 has exited: exit code = 0, exit time = 7/23/2018 11:41:31 AM.
23/07/2018 11:41:43 VERBOSE Received event notification for [UKSQL4].[Rubicon].[Brkr].[PDFServiceTargetQueue].
23/07/2018 11:41:43 VERBOSE Application process C:\Program Files\Company\Company.Rubicon.ServiceBroker.PDFService\Company.Rubicon.ServiceBroker.PDFService.exe was created: id = 55892.
23/07/2018 11:41:46 VERBOSE Received event notification for [UKSQL4].[Rubicon].[Brkr].[EmailTargetQueue].
23/07/2018 11:41:46 VERBOSE Application process C:\Program Files\Company\Company.Rubicon.ServiceBroker.Emailer\Company.Rubicon.ServiceBroker.Emailer.exe was created: id = 54584.
23/07/2018 11:41:47 VERBOSE Received event notification for [UKSQL4].[Rubicon].[Brkr].[PDFServiceTargetQueue].
23/07/2018 11:41:47 VERBOSE Application process C:\Program Files\Company\Company.Rubicon.ServiceBroker.PDFService\Company.Rubicon.ServiceBroker.PDFService.exe was created: id = 27984.
23/07/2018 11:41:53 VERBOSE Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
23/07/2018 11:41:53 VERBOSE Checkpointing recovery log completed.
23/07/2018 11:41:53 VERBOSE Application process id = 54584 has exited: exit code = 0, exit time = 7/23/2018 11:41:53 AM.
23/07/2018 11:41:54 VERBOSE Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
23/07/2018 11:41:54 VERBOSE Checkpointing recovery log completed.
23/07/2018 11:41:54 VERBOSE Application process id = 55892 has exited: exit code = 0, exit time = 7/23/2018 11:41:54 AM.
23/07/2018 11:41:55 VERBOSE Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
23/07/2018 11:41:55 VERBOSE Checkpointing recovery log completed.
23/07/2018 11:41:55 VERBOSE Application process id = 27984 has exited: exit code = 0, exit time = 7/23/2018 11:41:55 AM.
 

Does this look to be a normal amount of Checkpointing? Does anyone have any suggestions on how to track down the cause of the error?




MAX_QUEUE_READERS questions.

$
0
0

Greetings. 

I want to do some experimentation w this setting in Service Broker to see what sort of impact it can have in both speed and resource consumption. 

I have this setting in both an initiator and target queue, both of which call different sprocs. Does it ever make sense for these guys to not have this value matching? Would you ever want the target queue to have a lower number than the initiator?

Thanks!


Thanks in advance! ChrisRDBA

messages failing to arrive

$
0
0

Hi,

My company has a system where we have a mirrored server and multiple clients communicating with that server using service broker.  A new client was added recently and at first messages were being sent by the server and received by this new client. However, now the new client is neither receiving messages from the server nor is the server receiving messages from the client.

 

The sql logs for the client shows the error:

 

2008-07-21 14:05:44.28 spid14s     Error: 9642, Severity: 16, State: 3.

2008-07-21 14:05:44.28 spid14s     An error occurred in a Service Broker/Database Mirroring transport connection endpoint, Error: 8474, State: 11. (Near

endpoint role: Target, far endpoint address: '')

 

whilst the event log for the client gives:

 

An error occurred in Service Broker/Data mirroring transport connection endpoint Error:8471 State:2. (Near endpoint role: Initiator Far endpoint address '87.246.98.130')

An error occurred in Service Broker/Data mirroring transport connection endpoint Error:8471 State:2. (Near endpoint role: Initiator Far endpoint address '87.246.98.131')

The I.P. addresses above are those for the server and the mirror.

 

The brokers are running, the endpoints are running. But the transmission queues show the messages sitting there (both on the server and client) with the transmission_status column empty. The ports look to be configured correctly. We can telnet both ways. Have restarted sql server on client and endpoints on both client and server with no joy.

 

Any ideas.

Richard

Viewing all 461 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>