How to check Database mirroring is enabled on MS SQL Server or Log shipping is enabled

  • How to check Database mirroring is enabled  or Log shipping is enabled on MS SQL Server server ?

  • georgian2133 - Friday, May 12, 2017 8:19 AM

    How to check Database mirroring is enabled  or Log shipping is enabled on MS SQL Server server ?

    One option is that you could query the tables that would have information for any databases involved in mirroring or log shipping.
    SELECT * FROM sys.database_mirroring
    SELECT * FROM log_shipping_primary_databases

    database_mirroring will have a row for every database but the values of the columns with the name starting with mirroring_xxx would be null. So I guess you could get the database names for those using something like:
    SELECT d.name as MirroredDB
    FROM sys.database_mirroring m
    INNER JOIN sys.databases d on
    m.database_id = d.database_id
    WHERE m.mirroring_guid is not null

    SELECT primary_database as LogShippedDB
    FROM msdb.dbo.log_shipping_primary_databases
    WHERE primary_database is not null

    Sue

  • Thank you Sue for quick reply.

    I have checked on our production server with the commands you shared and its give me the details as i need.
    In current environment Mirroring is enabled.

  • This was removed by the editor as SPAM

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

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