TSQL to know if database mirroring is setup for both PRimary and secondary server
I have Database mirroring setup between two SQl 2005 servers (no witness). Using Tsql, I want to find if there is a user database on both primary and mirror server. I can use the following on mirror:
select * from sys.databases where state <>1 开发者_如何学Cand database_id>4
What should i use for Primary server?
Use the dmvs associated with database mirroring
For example, sys.database_mirroring
Kindly find Data using Following Query :-
**SELECT DB_NAME(database_id) AS Database_Name,
mirroring_state_desc,
mirroring_role_desc,
mirroring_safety_level_desc,
mirroring_partner_name,
mirroring_witness_name,
mirroring_witness_state_desc,
mirroring_failover_lsn
FROM sys.database_mirroring
WHERE mirroring_state IS NOT NULL;**
精彩评论