Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. USE [MMProdat]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[activateBroker] Script Date: 09/18/2014 19:41:41 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8.  
  9. ALTER PROCEDURE [dbo].[activateBroker]
  10. AS
  11. Set nocount on
  12.  
  13. --Cambio owner DB
  14. EXEC MMProDat.dbo.sp_changedbowner @loginame = N'sa', @map = false
  15. EXEC HistoricalData.dbo.sp_changedbowner @loginame = N'sa', @map = false
  16.  
  17. --Trusted DB
  18. ALTER DATABASE MMProdat SET trustworthy On
  19. ALTER DATABASE HistoricalData SET trustworthy On
  20.  
  21. --Habilita Broker
  22. ALTER DATABASE MMProdat SET ENABLE_BROKER
  23.  
  24. --Activa Colas
  25. --Send Queue State
  26. IF isNull((Select Convert(int,is_activation_enabled) + Convert(int,is_enqueue_enabled) + Convert(int,is_receive_enabled)
  27. From sys.service_queues WITH (nolock)
  28. Where name = 'SsbSendQueueState'),3) < 3
  29. Begin
  30. ALTER QUEUE SsbSendQueueState
  31. WITH STATUS=ON,
  32. ACTIVATION (
  33. STATUS = ON,
  34. PROCEDURE_NAME = SSBActivateSendHistoricalStates,
  35. MAX_QUEUE_READERS = 1,
  36. EXECUTE AS OWNER) ;
  37. End
  38.  
  39. --Receive Queue State
  40. IF isNull((Select Convert(int,is_activation_enabled) + Convert(int,is_enqueue_enabled) + Convert(int,is_receive_enabled)
  41. From sys.service_queues WITH (nolock)
  42. Where name = 'SsbReceiveQueueState'),3) < 3
  43. Begin
  44. ALTER QUEUE SsbReceiveQueueState
  45. WITH STATUS=ON,
  46. ACTIVATION (
  47. STATUS = ON,
  48. PROCEDURE_NAME = SSBActivateReceiveHistoricalStates,
  49. MAX_QUEUE_READERS = 1,
  50. EXECUTE AS OWNER) ;
  51. End
  52.  
  53. --Send Queue Interaction
  54. IF isNull((Select Convert(int,is_activation_enabled) + Convert(int,is_enqueue_enabled) + Convert(int,is_receive_enabled)
  55. From sys.service_queues WITH (nolock)
  56. Where name = 'SsbSendQueueInteraction'),3) < 3
  57. Begin
  58. ALTER QUEUE SsbSendQueueInteraction
  59. WITH STATUS=ON,
  60. ACTIVATION (
  61. STATUS = ON,
  62. PROCEDURE_NAME = SSBActivateSendHistoricalInteractions,
  63. MAX_QUEUE_READERS = 1,
  64. EXECUTE AS OWNER) ;
  65. End
  66.  
  67. --Receive Queue Interaction
  68. IF isNull((Select Convert(int,is_activation_enabled) + Convert(int,is_enqueue_enabled) + Convert(int,is_receive_enabled)
  69. From sys.service_queues WITH (nolock)
  70. Where name = 'SsbReceiveQueueInteraction'),3) < 3
  71. Begin
  72. ALTER QUEUE SsbReceiveQueueInteraction
  73. WITH STATUS=ON,
  74. ACTIVATION (
  75. STATUS = ON,
  76. PROCEDURE_NAME = SSBActivateReceiveHistoricalInteractions,
  77. MAX_QUEUE_READERS = 1,
  78. EXECUTE AS OWNER) ;
  79. End
  80.  
  81. --Receive Queue Dialer
  82. IF isNull((Select Convert(int,is_activation_enabled) + Convert(int,is_enqueue_enabled) + Convert(int,is_receive_enabled)
  83. From sys.service_queues WITH (nolock)
  84. Where name = 'SsbReceiveQueueDialer'),3) < 3
  85. Begin
  86. ALTER QUEUE SsbReceiveQueueDialer
  87. WITH STATUS=ON,
  88. ACTIVATION (
  89. STATUS = ON,
  90. PROCEDURE_NAME = SSBActivateReceiveHistoricalDialerInteractions,
  91. MAX_QUEUE_READERS = 1,
  92. EXECUTE AS OWNER) ;
  93. End
  94.  
  95. --Receive Queue Supervisor
  96. IF isNull((Select Convert(int,is_activation_enabled) + Convert(int,is_enqueue_enabled) + Convert(int,is_receive_enabled)
  97. From sys.service_queues WITH (nolock)
  98. Where name = 'SsbReceiveQueueSupervisor'),3) < 3
  99. Begin
  100. ALTER QUEUE SsbReceiveQueueSupervisor
  101. WITH STATUS=ON,
  102. ACTIVATION (
  103. STATUS = ON,
  104. PROCEDURE_NAME = SSBActivateReceiveHistoricalSupervisorInteractions,
  105. MAX_QUEUE_READERS = 1,
  106. EXECUTE AS OWNER) ;
  107. End
  108.  
  109. --Send Queue Dialer
  110. IF isNull((Select Convert(int,is_activation_enabled) + Convert(int,is_enqueue_enabled) + Convert(int,is_receive_enabled)
  111. From sys.service_queues WITH (nolock)
  112. Where name = 'SsbSendQueueDialer'),3) < 3
  113. Begin
  114. ALTER QUEUE SsbSendQueueDialer
  115. WITH STATUS=ON,
  116. ACTIVATION (
  117. STATUS = ON,
  118. PROCEDURE_NAME = SSBActivateSendHistoricalDialerInteractions,
  119. MAX_QUEUE_READERS = 1,
  120. EXECUTE AS OWNER) ;
  121. End
  122.  
  123. --Send Queue Supervisor
  124. IF isNull((Select Convert(int,is_activation_enabled) + Convert(int,is_enqueue_enabled) + Convert(int,is_receive_enabled)
  125. From sys.service_queues WITH (nolock)
  126. Where name = 'SsbSendQueueSupervisor'),3) < 3
  127. Begin
  128. ALTER QUEUE SsbSendQueueSupervisor
  129. WITH STATUS=ON,
  130. ACTIVATION (
  131. STATUS = ON,
  132. PROCEDURE_NAME = SSBActivateSendHistoricalSupervisorInteractions,
  133. MAX_QUEUE_READERS = 1,
  134. EXECUTE AS OWNER) ;
  135. End
  136.  
  137. Set nocount off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement