How to detect "In Recovery"

  • I am trying to instrument a new Mirroring setup ( synchronous with witness) and have added MS's recommended WMI alerts for mirroring events.

    The one situation that I cannot detect is if the primary role machine is unplugged from Ethernet.

    Mirrorring works in that the the other machine goes live ( "Principal, Disconnected") but the unplugged machine goes to "Principal, Disconnected / In Recovery" and does not run any Alerts - presumably because it is still "Principal"

    I need to detect this transition to shut down some processes that should only run on the "real" primary server.

    Any ideas how to detect the In Recovery state?

    Thanks

    Bill

  • You should be able to detect it using a query of sys.databases. I'm not sure how to create an alert based of that though

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Or use the DATABASEPROPERTY function like this

    SELECTDATABASEPROPERTY('master', 'IsInRecovery')


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply