T-SQL – To Check if Database are configured for Mirroring

T-SQL – To Check if Database are configured for Mirroring

If you want to check whether the databases are configured for mirroring or not, then below script would be a great help.

SELECT

A.name,

CASE

   WHEN B.mirroring_state is NULL THEN ‘Mirroring is not configured’

   ELSE ‘Mirroring is 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

Advertisements

One thought on “T-SQL – To Check if Database are configured for Mirroring

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s