Checking SQL database mirroring health

  • Hi Gurus,

    There is database mirroring currently setup in my environment.

    I do not want to use SQL management studio (database mirroring monitor) to check its mirroring status.

    q1) is checking/reading from sys.database_mirroring sufficient ? is there any difference when reading from the

    primary instance or mirrored instance ?

    q2) is there anyway we can check the last LSN on disk in the primary database vs the last LSN on mirror database ?

    (I am not sure if comparing the column value of mirroring_failover_lsn vs mirroring_end_of_log_lsn ) would help ?

    my understanding =

    mirroring_end_of_log_lsn -> local

    mirroring_failover_lsn -> both local and mirrored

    if a mirrored database is out of sync, what would the value of these 2 columns reflect ?

    q3) lastly, if i would like to check the mirrored database datafile path , should i select from sys.sysaltfiles in the mirrored instance ? or there is other view/ways to do so ?

    Regards,

    Noob

  • Hi, this query may get you some of what you are looking for (fill in your db name):

    --Redo Queue KB

    --Total number of kilobytes of hardened log that currently remain to be applied to the mirror database to roll it forward. This is sent to the Principal from the Mirror.

    --Log Send Queue KB

    --Total number of kilobytes of log that have not yet been sent to the mirror server.

    SELECT [counter_name] as CounterName,[cntr_value] as CounterValue

    FROM sys.dm_os_performance_counters

    WHERE [object_name] LIKE ('%Database Mirroring%')

    AND [counter_name] IN ('Log Send Queue KB','Redo Queue KB')

    AND [instance_name]='myDatabase'

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

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