database mirroring

  • hi friends,

    can u help me that how to monitor Database Mirroring using queries not with GUI Interface?

    please help me regarding this

    thanks in advance

  • Hi there,

    These are the queries I am currently playing around with:

    --to retrieve the information shown in the GUI "Database Mirroring Monitor", for a specific database

    use msdb

    --info under the "Status" tab

    exec sys.sp_dbmmonitorresults @database_name=N'AdventureWorksDW', @mode = 0, @update_table = 1

    --info under the "Warnings" tab

    exec sys.sp_dbmmonitorhelpalert @database_name=N'AdventureWorksDW'

    --view the "Database Mirroring History" for the last 2 hours

    exec sys.sp_dbmmonitorresults @database_name=N'AdventureWorksDW', @mode = 1, @update_table = 0

    --view the "Database Mirroring History" for the last 24 hours

    exec sys.sp_dbmmonitorresults @database_name=N'AdventureWorksDW', @mode = 4, @update_table = 0

    Hope this helps,

    Andy

  • You can also use these System Views:

    --built-in Views to monitor Mirroring Status

    select * from sys.database_mirroring

    select * from sys.database_mirroring_endpoints

    select * from sys.database_mirroring_witnesses

    select * from sys.dm_db_mirroring_connections

  • Hi,

    To query the system monitor counters directly (which is what the stored procedures do) try this:

    SELECT * FROM sys.dm_os_performance_counters

    WHERE OBJECT_NAME = 'SQLServer:Database Mirroring'

    Thanks, Craig

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

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