Use ssbdiagnose to do the following:
-
Confirm that there are no configuration errors in a newly configured Service Broker application.
-
Confirm that there are no configuration errors after changing the configuration of an existing Service Broker application.
-
Confirm that there are no configuration errors after a Service Broker database is detached and then reattached to a new instance of the Database Engine.
-
Research whether there are configuration errors when messages are not successfully transmitted between services.
-
Get a report of any errors that occur in a set of Service Broker conversation elements.
For information about the errors returned by ssbdiagnose, see Errors and Events Reference (Service Broker).
Configuration Reporting
To correctly analyze the configuration used by a conversation, run a ssbdiagnose configuration report that uses the same options that are used by the conversation. If you specify a lower level of options for ssbdiagnose than are used by the conversation, ssbdiagnose might not report conditions that are required by the conversation. If you specify a higher level of options for ssbdiagnose, it might report items that are not required by the conversation. For example, a conversation between two services in the same database can be run with ENCPRYPTION OFF. If you run ssbdiagnose to validate the configuration between the two services, but use the default ENCRYPTION ON setting, ssbdiagnose reports that the database is missing a master key. A master key is not required for the conversation.
The ssbdiagnose configuration report analyzes only one Service Broker service or a single pair of services every time it is run. To report on multiple pairs of Service Broker services, build a .cmd command file that calls ssbdiagnose multiple times.
Runtime Reporting
When -RUNTIME is specified, ssbdiagnose searches all databases specified in runtimeconnectionoptions and baseconnectionoptions to build a list of Service Broker IDs. The full list of IDs built depends on what is specified for -NEW and -ID:
-
If neither -NEW or -ID are specified, the list includes all conversations for all databases specified in the connection options.
-
If -NEW is specified, ssbdiagnose includes the elements for the first conversation that starts after ssbdiagnose is run. This includes the conversation ID and the conversation handles for both the target and initiator conversation endpoints.
-
If -ID is specified with a conversation handle, only that handle is included in the list.
-
If -ID is specified with a conversation ID, the conversation ID and the handles for both of its conversation endpoints are added to the list.
-
If -ID is specified with a conversation group ID, all the conversation IDs and conversation handles in that group are added to the list.
The list does not include elements from databases that are not covered by the connection options. For example, assume that you use -ID to specify a conversation ID, but only provide a runtimeconnectionoptions clause for the initiator database and not the target database. ssbdiagnose will not include the target conversation handle in its list of IDs, only the conversation ID and the initiator conversation handle.
ssbdiagnose monitors the SQL Server Profiler events from the databases covered by runtimeconnectionoptions and baseconnectionoptions. It searches for Service Broker events that indicate an error was encountered by one or more of the Service Broker IDs in the runtime list. ssbdiagnose also searches for system-level Service Broker error events not specifically associated with any conversation group.
If ssbdiagnose finds conversation errors, the utility will attempt to report on the root cause of the events by also running a configuration report. ssbdiagnose uses the metadata in the databases to try to determine the instances, Service Broker IDs, databases, services, and contracts used by the conversation. It then runs a configuration report using all available information.
By default, ssbdiagnose does not report error events. It only reports the underlying issues found during the configuration check. This minimizes the amount of information reported and helps you focus on the underlying configuration issues. You can specify -SHOWEVENTS to see the error events encountered by ssbdiagnose.
Issues Reported by ssbdiagnose
ssbdiagnose reports three classes of issues. In the XML output file, each class of issue is reported as a separate type of the Issue element. The three types of issues reported by ssbdiagnose are as follows:
-
Diagnosis
-
Reports a configuration issue. This includes issues found either a CONFIGURATION report is running, or during the configuration phase of a RUNTIME report. ssbdiagnose reports each configuration issue one time.
-
Event
-
Reports a SQL Server Profiler event that indicates a problem was encountered by a conversation being monitored during a RUNTIME report. ssbdiagnose reports events every time they are generated. Events can be reported multiple times if several conversations encounter the problem.
-
Problem
-
Reports an issue that is preventing ssbdiagnose from completing a configuration analysis or from monitoring conversations.
sqlcmd Environment Variables
The ssbdiagnose utility supports the SQLCMDSERVER, SQLCMDUSER, SQLCMDPASSWORD, and SQLCMDLOGINTIMOUT environment variables that are also used by the sqlcmd utility. You can set the environment variables either by using the command prompt SET command, or by using the setvar command in Transact-SQL scripts that you run by using sqlcmd. For more information about how to use setvar in sqlcmd, see Using sqlcmd with Scripting Variables.