none
List of Database Mirroring configured databases in SQL Server RRS feed

  • Question

  • Is there any script to get the list of database mirroring configured databases in SQL Server 2014?

    Tuesday, March 15, 2016 5:07 AM

Answers

  • Try this

    SELECT
    A.name,
    CASE
        WHEN B.mirroring_state is NULL THEN 'Mirroring not configured'
        ELSE 'Mirroring configured'
    END as MirroringState
    FROM
    sys.databases A
    INNER JOIN sys.database_mirroring B
    ON A.database_id=B.database_id
    WHERE a.database_id > 4
    ORDER BY A.NAME
    


    Thanks Saravana Kumar C

    Tuesday, March 15, 2016 6:08 AM

All replies

  • Hi Jason,

    Have you looked at sys.database_mirroring?  You can do select * from sys.database_mirroring.  

    https://msdn.microsoft.com/en-us/library/ms178655.aspx

    Regards,
    John

    • Proposed as answer by JohnSterrett Wednesday, March 16, 2016 4:45 PM
    Tuesday, March 15, 2016 6:06 AM
  • Try this

    SELECT
    A.name,
    CASE
        WHEN B.mirroring_state is NULL THEN 'Mirroring not configured'
        ELSE 'Mirroring configured'
    END as MirroringState
    FROM
    sys.databases A
    INNER JOIN sys.database_mirroring B
    ON A.database_id=B.database_id
    WHERE a.database_id > 4
    ORDER BY A.NAME
    


    Thanks Saravana Kumar C

    Tuesday, March 15, 2016 6:08 AM