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

SQL Service Broker 2012: the connection was closed by the remote end, or an error occurred while receiving data: '64(The specified network name is no longer available.)'

$
0
0

Anyone can help with the below issue please? Much appreciated.

  1. We have about 2k+ messages in sys.transmission_queue
  2. Telnet to the ports 4022 is working fine.
  3. Network connectivity has been ruled out.
  4. The firewalls are OFF.
  5. We also explicitly provided the permissions to the service account on Server A and Server B to the Service broker end points.GRANTCONNECTON ENDPOINT <broker> <domain\serviceaccount>
  6. Currently for troubleshooting purposes, the DR node is also out of the Availability Group, which means that we right now have only one replica the server is now a traditional cluster.

Important thing to note is when a SQL Server service is restarted, all the messages in the sys.transmission queue is cleared immediately. After about 30-40 minutes, the errors are continued to be seen with the below

Theconnectionwas closedbytheremoteend,oran erroroccurredwhilereceivingdata: '64(The specified network name is no longer available.)'


Service Broker not responding to initiator and messages get stuck in transmissions queue

$
0
0

We keep having an outage roughly once a week where the messages get stuck in the transmission queue.  We have got 2 application servers that sends messages to a database.  The app servers are standalone VMs and the database that these app servers send messages to, is in a clustered environment.  

The SSB in one of these app servers goes down once a while with the error message - An error occurred while receiving data: '64(The specified network name is no longer available.)'.  Until now, this did not happen on both app servers at the same time. 

We were able to telnet/ping at the time of outage.  What might possibly be happening?  Let me know if there are any additional details needed.

Setting the database in single user mode, disabling service broker and then enabling it, fixes everything.


How to ignore service broker option for database deployment on always on server

$
0
0

We have setup service broker on our always on database. However, when we are trying to deploy database (sqlproj), deployment script tries to disable broker and fails, as database is part of always on group. When I checked where Disable broker call is being made from, found that the setting is in sqlproj properties. I don’t find any option to ignore broker settings. How can I ignore service broker options in my project, so it never tries to alter whatever broker settings are present on the database?

 below is the error that I am receiving during deployment:

Error SQL72014: .Net SqlClient Data Provider: Msg 1468, Level 16, State 1, Line 5 The operation cannot be performed on database "DBName" because it is involved in a database mirroring session or an availability group. Some operations are not allowed on a database that is participating in a database mirroring session or in an availability group.

Error SQL72045: Script execution error.  The executed script:

IF EXISTS (SELECT 1

FROM   [master].[dbo].[sysdatabases]

WHERE  [name] = N'$(DatabaseName)')

   BEGIN

ALTER DATABASE [$(DatabaseName)]

SET DISABLE_BROKER

WITH ROLLBACK IMMEDIATE;

   END


Questions about SQLDependency

$
0
0

I am trying setup SQL dependency on local machine using SQL express, and i have following questions

1>Does SQL dependency works with SQLExpress or do i need full SQL Server?

2>On local machine, The dbo user is running under my login account. My login account is "sysadmin" in ./SQLExpress. Im assuming that means it has all the permissions. Do i still need to set all other permissions to run SQLDependency?

3>When i Start dependency by passing queue name, i get the following exception

When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.

 When I don’t pass queue name, I don’t get exception but .net application doesn’t get call back either when SQL table is updated.

(Note that eventually i'm going to call Intialization() method at application start)

Here is my complete code

    public class SqlHelper
    {
        public void Initialization()
        {
            // Create a dependency connection.
            SqlDependency.Start(GetConnectionString(), "SendStatusChangeMessages");
            CanRequestNotifications();
        }

        public void SomeMethod()
        {
            // Assume connection is an open SqlConnection.
            using (SqlConnection con = new SqlConnection(GetConnectionString()))
            {
                con.Open();

                // Create a new SqlCommand object.
                using (SqlCommand command = new SqlCommand(
                    "SELECT BatchStatus from MyTable WHERE ID = 1",
                    con))
                {

                    // Create a dependency and associate it with the SqlCommand.
                    SqlDependency dependency = new SqlDependency(command);
                    // Maintain the refence in a class member.

                    // Subscribe to the SqlDependency event.
                    dependency.OnChange += new
                       OnChangeEventHandler(OnDependencyChange);

                    Initialization();

                    // Execute the command.
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var message = reader.GetString(0);
                        }
                    }
                }
            }
        }

        // Handler method
        public void OnDependencyChange(object sender,
           SqlNotificationEventArgs e)
        {
            var info = e.Info;
        }

        public void Termination()
        {
            // Release the dependency.
            SqlDependency.Stop(GetConnectionString(), "SendStatusChangeMessages");
        }

        private string GetConnectionString()
        {
            return System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
        }

        private bool CanRequestNotifications()
        {
            SqlClientPermission permission =
                new SqlClientPermission(
                PermissionState.Unrestricted);
            try
            {
                permission.Demand();
                return true;
            }
            catch (System.Exception)
            {
                return false;
            }
        }
    }





Send Email using service broker

$
0
0

Hi,

i have a service broker application that i send message to the queue and a specific SP reads the message and process it, part of this processing is sending the information found on that message to a specific email accounts. this means i have two service broker applicatins, one for my business (sending messages to queue to be processed and the secound one is the SendEmail service)

 

when i send email using the SP "msdb.dbo.sp_send_dbmail" the email is recieved 100% true, but when i come to send the email through the SP which recieve the messages from the SB queue, the email is not sent and i dont know where it goes.

 

this means that i cant read from a queue and send to another one at the same time... can you help me in this!

 

-Rana

error with SQL syntax

$
0
0

I'm trying to get onto a website i could normally get into but all it says is this

you have an error in your SQL syntax;check the manual that corresponds to your MySQL server version for the right syntax to use near') and adlx.'action' !=  2' at line 1

I'm not good with computers and I've never heard of this i need some help, I may just be stupid but i seriously need some help here

preferably instructions for a hp computer

SQL Notification Firing Erratically

$
0
0

Hello everyone and thanks for your help in advance.  I am wokring on a SignalR application.  Within the hub, I have the following code:

    Private Sub dependency_OnChange(sender As Object, e As SqlNotificationEventArgs)
        Dim nHub As New NotificationHub()
        nHub.SendNotifications()
    End Sub

This works but fires multiple multiple times for any single record operation.  I then tried:

    Private Sub dependency_OnChange(sender As Object, e As SqlNotificationEventArgs)
        If e.Type = SqlNotificationType.Change Then
            Dim nHub As New NotificationHub()
            nHub.SendNotifications()
        End If
    End Sub

However, this causes no notification to be issued.  Upon checking, I found the e.Type was equal to "Subscribe".  I then changed the code to utilize SqlNotificationInfo:

        If e.Info = SqlNotificationInfo.Insert _
        Or e.Info = SqlNotificationInfo.Delete _
        Or e.Info = SqlNotificationInfo.Update Then
                 Dim nHub As New NotificationHub()
                 nHub.SendNotifications()   
        End If

However, this doesn't fire either.  I'm not really sure where to go next.  Any help would be greatly appreciated.

External Activator not launching Application

$
0
0

Hello

I am setup an External Activator solution . I think I got everything as it should be, but the application is just not launching on the QUEUE_ACTIVATION event

External Activator service start successfully and its shows a RECEIVES_OCCURRING status in sys.dm_broker_queue_monitors.

The sys.transmission_queue is empty and I can see the messages appearing in sys.conversation_endpoints with a state of CONVERSING

If I run my Application manually it completes the “Receive” command and reply a message without error.

Any ideas?

Regards, WDV


A database user associated with the secure conversation was dropped before credentials had been exchanged with the far endpoint. Avoid using DROP USER while conversations are being created.

$
0
0

Hi. I was repeatedly receiving this error message in a SQL Server 2008 Error Log:

A database user associated with the secure conversation was dropped before credentials had been exchanged with the far endpoint. Avoid using DROP USER while conversations are being created.

The only references I found to this error message were support issues occuring while a database was being restored.

KB 2483090: Restore or recovery may fail or take a long time if query notification is used in a database

KB 974777: Database restore operation may fail during the recovery phase when the database uses query notification in SQL Server 2005/2008

However, this database was alive and well, and was not in the process of restoring or failing over. The users were noticing a severe degradation in messages being serviced.

I was able to terminate this message by restarting Service Broker for the database in question.

ALTER DATABASE [mydb] SET DISABLE_BROKER WITH ROLLBACK IMMEDIATE

ALTER DATABASE [mydb] SET SINGLE_USER WITH ROLLBACK IMMEDIATE

ALTER DATABASE [mydb] SET NEW_BROKER WITH ROLLBACK IMMEDIATE

ALTER DATABASE [mydb] SET ENABLE_BROKER WITH NO_WAIT

ALTER DATABASE [mydb] SET MULTI_USER WITH ROLLBACK IMMEDIATE

I'm just posting this for anyone else who comes across the same issue.

All methods of change notification are based on a periodic queries of database - is it true?

$
0
0

Dear Gurus!

I need in silverlight application system of notification about changes in mssql database.

I have try to use service broker, but met the problem - when service wait notification - ria services query are blocking.

Maybe I just made ​​a mistake somewhere.

I met statement that "All methods of change notification are based on a periodic queries of database" .

1. Is it true? 

2. Is it right way to use service broker for a such task?

3. Can mssql  itself to notify the  server application about  changes, say using an interrupt when the some trigger is fired?

Thanks in advance!

Service broker message stuck in Transmission Queue

$
0
0
Hi,

I have a fairly simple Service Broker set up to send messages between 2 DBs within the same instance. Since there is no cross-networking here, I did not set up any routes. So I have a SendQ associated with SendService in DB1 and a ReceiveQ associated with ReceiveService in DB2. Both are on Server S1.

I've set TRUSTWORTH on both DBs.
ALTER DATABASE <DBNAME> SET TRUSTWORTHY ON

Since I'm using Integrated Windows security, I also granted send permission to public
GRANT SEND ON SERVICE::ReceiveService TO [public];

However when I send out a message, it doesn't go to either the SendQ or ReceiveQ. Instead it sits in the sys.transmission_queue with the following message

An exception occurred while enqueueing a message in the target queue. Error: 916, State: 3. The server principal "S-1-9-3-4070899528-1141234901-971043712-2725434662." is not able to access the database "DB2" under the current security context.

Can anyone please help me with what I might be doing wrong or missing here? Thanks,

Wcf ria services - how to realise notification about changes in the database

$
0
0

Dear Gurus!

Is there in wcf ria services  any built-in mechanism for notification about changes in the database?  

Can't stop service

$
0
0

Dear Gurus!

I create service with next code:

        public void AddEventChanges()
        {

            lbNames.Items.Clear();
            SqlDependency.Stop(connectionString);
            SqlDependency.Start(connectionString);

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("Select id_event,name,description from dbo.events", connection))
                {
                    cmd.Notification = null;

                    SqlDependency dependency = new SqlDependency(cmd);
                    dependency.OnChange += new OnChangeEventHandler(WaitChange);
                    connection.Open();
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {                       
                        while (reader.Read())
                        {
                            lbNames.Items.Add(reader.GetString(1));
                        }
                    }
                    connection.Close();
                }
            }
        }

And try to stop it with next code:

        [OperationContract]
        public void StopTrackingChanges()
        {
            SqlDependency.Stop(connectionString); 
        }
But service don't stop 

Sometimes it stopped and sometimes it don't. What I am doing wrong?

Notification does not always fires

$
0
0

Dear Gurus!

I use VS 2012 and silverlight project in c#. I am trying to make the  event notification system with using signalR.

On the server side I want to use service broker - start notification and when triggered notification - I write the time to static variable. I start notification in Global.asax.cs file as follows:

public class Global : System.Web.HttpApplication { const string ConnectionString = @"Server=TERENTIEVAI; Initial Catalog=road; User ID =dependency_client; Password =111111; Trusted_Connection =False; Integrated Security=True; Asynchronous Processing=True; "; void Application_Start(object sender, EventArgs e) { sqlHelper.lastChangesDate = DateTime.Now; startWaitingChanges(); } public static void startWaitingChanges() { SqlDependency.Stop(ConnectionString); SqlDependency.Start(ConnectionString); using (SqlConnection connection = new SqlConnection(ConnectionString)) { using (SqlCommand cmd = new SqlCommand("Select name,description,date_liquidation from dbo.events", connection)) { cmd.Notification = null; SqlDependency dependency = new SqlDependency(cmd); dependency.OnChange += new OnChangeEventHandler(HandleChanges); connection.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { } connection.Close(); } } } public static void HandleChanges(object sender, SqlNotificationEventArgs e) { sqlHelper.lastChangesDate = DateTime.Now; SqlDependency dep = sender as SqlDependency; dep.OnChange -= new OnChangeEventHandler(HandleChanges);

startWaitingChanges(); }

For the first time  the notification always fires. But then it fires sometimes and sometime it not fires.

What I do wrong?

 

SQL Server Service Broker Updating Stored procedure

$
0
0

how can you update the service broker stored procedure. when i update the stored procedure the changes dont come into affect. i have tried to alter the queue, waited for all jobs to finish, but some how still the old stored procedure is running. is there any way i can force changes to the stored procedure.

i have tried sql profiler tracing but that didnt show any changes.

I cannot alter the service broker stored procedure, when I update the stored procedure it does not show any error and successfully gets updated but the changes does not come into affect.

Is it because I need to stop the queue of the service broker on both databases before the changes could come into affect?

Note: the service broker stored procedures produce and read xmls.




Notify Operator Task not sending email, Database mail works fine, Added Profile to Agent

$
0
0

SQL Server 2008 R2, Latest Updates. 

I added a Service Broker that has Alerts and Notifications in it.  In adding the service broker I had to go into the Agent Properties, Alert System, enable mail Profile, enabled the failsafe operator, etc. 

I get email Alerts from the Service Broker that I Installed. I get the test emails too.  On the Properties of the Agent Job, I can get an email of the Completion, success or failure of the Job itself. 

If I create a Maintenance Plan, that all that is in it a a Notify Operator Task, set it up with the same users, I never get the emails. If I go into the Reporting and Logging an then sent a email of the Log of the Job, I get that just fine too.

Microsoft(R) Server Maintenance Utility (Unicode) Version 10.50.2500
Report was generated on "SQL".
Maintenance Plan: TestEmail
Duration: 00:00:00
Status: Succeeded.
Details:
F Notify Operator - Success (SQL)
Task start: 2014-06-02T08:45:07.
Task end: 2014-06-02T08:45:07.
Success

This started AFTER I enable the Alert System, Enable Mail Profile. 

The server has been rebooted a few times since this started happening, so its not because I have not restarted the Agent. 

If I uncheck the Enable Mail Profile in the Agent Alert System, I still get the Job's Log, but not the email of the Completion, Success or Failure. 

server guid value

$
0
0

is it required to change the server guid value for a database that is being attached to a newer instance of sql? I didn't think so, but what I'm finding is that the broker infrastructure does not startup unless is issue the 'alter db XXX set new_broker' stmt...then everything seems to fire up fine.

so I'm detaching a db from on instance (2005) and attaching to another 2012. I have a cert that needs to be dropped before I can set the master key value in the  db. I drop the cert, drop master key, create master key, create cert w/authorization.

I have a notification service at server level that doesn't fire up...I drop the whole lot of it, recreate it...but still nothing.  it's capturing sql login/out/failure events.

But once I change the server guid value for the newly attached db...everything takes off...

does this sound weird?

thanks in advance.

-mt


mike t.

Service Broker External Activator Service stuck in "Stopping" mode after error 90

$
0
0

Hi,

We are using the Service Broker External Activator Service and we've come across an error involving runtime checkpointing and the process not being able to access the EARecovery.rlog file.. it goes like this:

2014/06/09 10:15VERBOSECheckpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
2014/06/09 10:15ERRORThe External Activator service is aborting ...
2014/06/09 10:15EXCEPTIONERROR = 90, Internal exceptions have occurred when External Activator is runtime checkpointing.
2014/06/09 10:15EXCEPTIONDETAILSInner Exception:
2014/06/09 10:15EXCEPTIONDETAILSSystem.IO.IOException: The process cannot access the file 'C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog' because it is being used by another process.
2014/06/09 10:15EXCEPTIONDETAILS  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2014/06/09 10:15EXCEPTIONDETAILS  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
2014/06/09 10:15EXCEPTIONDETAILS  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
2014/06/09 10:15EXCEPTIONDETAILS  at ExternalActivator.LogManager.CompressRecoveryLog(LogRecoveryContext recoveryContext)
2014/06/09 10:15EXCEPTIONDETAILS  at ExternalActivator.LogManager.Checkpoint(LogRecoveryContext recoveryContext)
2014/06/09 10:15EXCEPTIONDETAILS  at ExternalActivator.LogManager.Log(LogRecord recoveryLogRec)
2014/06/09 10:15EXCEPTIONDETAILS  at ExternalActivator.ApplicationMonitor.OnProcessExited(ProcessMonitor processMonitor)
2014/06/09 10:15EXCEPTIONDETAILS  at ExternalActivator.ProcessMonitor.NotifySubscriber()
2014/06/09 10:15EXCEPTIONDETAILS  at ExternalActivator.ProcessMonitor.OnProcessExited(Object a, EventArgs b)
2014/06/09 10:15VERBOSEHeartbeat-Thread is exiting...
2014/06/09 10:15VERBOSEWaiting for worker threads to finish...
2014/06/09 14:13======================================================================================
2014/06/09 14:13======================================================================================

This happened a few days ago and we are pretty sure nobody was using the file as this is a production application server... and then it happened again several days later...

We have to kill the process and restart the service to get things going again.

Any help would be greatly appreciated as this is not a viable way of doing things for us.

Thanks

Gabriel

Log files full of service broker errors, but it works OK

$
0
0

We have a C# web application that is using SQL dependency to expire cached query data. Although everything is working okay we are seeing a lot of errors being generated particularly in our production environment.

The first error messages is this:

Service Broker needs to access the master key in the database 'SubscriberManager'. Error code:32. The master key has to exist and the service master key encryption is required.

It shows up in both the server event log and the SQL server log files. I believe the actual content of the messages something of a red herring as I have created a database master key.

I have also tried

  • Recreating both the service master key and the database master key.
  • Made sure the database owner is sa.
  • Made sure the user account has permissions to create services, queues, procedures and subscribe query notifications
  • Made sure the broker is enabled

I have seen other people with similar errors whilst researching the issue but the error code almost always seems to be 25 or 26 not 32. I have been unable to find anything that tells me what these error codes mean so I'm not sure of the significance.

Also I am seeing a lot of errors like this:

The query notification dialog on conversation handle '{2FA2445B-1667-E311-943C-02C798B618C6}.' closed due to the following error: '-8490Cannot find the remote service 'SqlQueryNotificationService-7303d251-1eb2-4f3a-9e08-d5d17c28b6cf' because it does not exist.'.

I understand that a certain number of these are normal due to the way that SqlDependency.Stop doesn't clean everything up in the database, but we are seeing thousands of these on one of our production servers.

What is frustrating as we have been using SQL notifications for several years now without issue so something must have changed in either our application or the server setups to cause this but at this point I have no idea what.

The applications are .net 4.0 MVC and WCF running on Windows 2012 servers calling SQL 2012 servers also running on Windows 2012.

Can service broker work between SQL Server 2008 and 2012, ssbdiagnose returned an error !

$
0
0

Hello, 

We have a setup of three applications that sends and receive messages using Service Broker.
One part is on a server, we'll call 'S' have Microsoft SQL Server 2008 (SP3) - 10.0.5512.0 (X64)

The other part, we'll call 'E' use to have Microsoft SQL Server 2008 (SP3) - 10.0.5512.0 (X64).
But I am migrating these apps to a new server, we'll call 'C' that has: Microsoft SQL Server 2012 (SP1) - 11.0.3339.0 (X64)

I have used this command line tool to test it :
ssbdiagnose -E CONFIGURATION FROM SERVICE "//E/S/CService" -S "ServerC" -d EDatabase TO SERVICE "//S/S/ECService" -S ServerS -d SDatabase ON CONTRACT //E/S/ECContact

It returned: 
An internal exception occurred: Cannot read property ServiceBrokerGuid.
This property is not available on SQL Server 7.0.

So, I am wondering, is it supposed to work between these two versions ?

As more info, in the previous setup, it was using certificates but I have changed the Endpoints to use only Windows Authentication.

Thanks for any advice.
Claude

Viewing all 461 articles
Browse latest View live


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