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

Clearing all messages from a service broker queue

$
0
0

Hi All,

Iam currently trying to remove the messages from the queue if the count is more than 15000 as shown below in the stored procedure :

      Declare @CountMBSClientStatusSendQueue BIGINT
      SELECT  @CountMBSClientStatusSendQueue=rows
      From sys.partitions P
      Inner Join sys.internal_tables IT On IT.object_id = P.object_id
      Where IT.parent_object_id = object_id('MBSClientStatusSendQueue')
      And P.index_id In (1, 0)

      IF @CountMBSClientStatusSendQueue > 15000 
            ALTER DATABASE MBS SET NEW_BROKER WITH ROLLBACK IMMEDIATE

But the memory usage of the Sql server was very high and effecting the performance of the sql server. So I would like to know the easiest and the best way to cleanup the messages in the queues after the count is more than 10000

Kindly help me on the same.

Thanks,

Ram


ram


Viewing all articles
Browse latest Browse all 461

Trending Articles



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