Freigeben über


Launching Database Mirroring Monitor without having to go through SSMS

Yesterday, while co-delivering a seminar on Database Mirroring to a few customers, one of them asked whether it was possible to open Database Mirroring Monitor in an easier, more straight forward way than having to open SQL Server Management Studio, connecting to one instance, expanding the Databases node, right clicking on one of the databases, selecting Tasks… , and then clicking on Launch Database Mirroring Monitor… .

The only thing I knew was that the executable instantiated when you launched DBM Monitor was SQLMonitor.exe, the same which is instantiated when you invoke the Replication Monitor.

We noticed though, that if we manually executed SQLMonitor.exe, it automatically opened in the context of the Replication Monitor. Therefore, it required an additional manual step to set its context to that of Database Mirroring Monitor. To do so, as most of you are probably aware already, you have to select the Go menu, and then click on Database Mirroring Monitor.

Still, if SSMS was able to launch it and automatically leave it as we wanted, there should be a hidden/undocumented way to invoke the executable specifying such desire.

A bit of investigation in the way SSMS’ menu handler was implemented followed by a review of the code that implements SQLMonitor’s common framework revealed the existence of a command-line switch which facilitates just what we were looking for: the –M (aka /M) switch.

At the time this post was written, you could invoke SQLMonitor.exe providing the /M (mode) switch followed by a blank space, and then followed by one of the following two values:

“Replication Monitor” if you want it to automatically select the Replication Monitor view. Not specifying the parameter in the command-line, or specifying it but leaving its value either empty would have the same effect and would open the interface in the context of Replication Monitor.

“dbmmonitor” if you want it to automatically select the Database Mirroring Monitor view.

Just as an additional information note, the path where SQL Server setup installs this utility is persisted in the Registry at the following locations.

HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\SQLPath if it is the SQLMonitor.exe which comes with SQL Server 2005 and it is installed on a 32-bit operating system.

HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\SQLPath if it is the SQLMonitor.exe which comes with SQL Server 2005 and it is installed on a 64-bit operating system.

image

HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\ClientSetup\SQLPath if it is the SQLMonitor.exe which comes with SQL Server 2008 or SQL Server 2008 R2 and it is installed on a 32-bit operating system.

HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\100\Tools\ClientSetup\SQLPath if it is the SQLMonitor.exe which comes with SQL Server 2008 or SQL Server 2008 R2 and it is installed on a 64-bit operating system.

image

That’s it as for today.