Below script can be used to check if the databases are configured for Database Mirroring for a given SQL Server instance. This information can be pulled using SQL Server Management Studio (See below the steps), but if you have lots of databases it might takes very long time to check.
-
Right-click the database, select Tasks, and then click Mirror. This opens the Mirroring page of the Database Properties dialog box.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
USE [master]; GO SELECT @@SERVERNAME as [Server Name], d.name As [Databse Name], CASE WHEN m.mirroring_state is NULL THEN 'Not Mirrored' ELSE 'Mirrored' END as [Status], m.mirroring_state_desc as [State of the mirrored database], m.mirroring_role_desc as [Current role in the database mirroring session], m.mirroring_witness_state_desc as [State of the witness in the database mirroring session] FROM sys.databases d INNER JOIN sys.database_mirroring m ON d.database_id=m.database_id WHERE d.database_id > 4 ORDER BY d.NAME |
Leave a Comment