SMO-how to get the mirror server of a database?
-
Wednesday, February 15, 2012 1:43 AMSMO-how to get the mirror server of a database? SQL server 2008 R2
thanks, eric
All Replies
-
Thursday, February 16, 2012 4:27 AMModerator
Hi Eric,
Since database mirroring is a database level feature, so you can only determine whether a database is mirroring enabled within an instance. In SMO, there is a property named IsMirroringEnabled on database class, which can be used to identify the mirroring.
In your scenario, you may need to specify the SQL Server instance and loop each database in it to find out the databases enabled mirroring based on the IsMirroringEnabled property. For more information: Database.IsMirroringEnabled Property.
Stephanie Lv
TechNet Community Support
- Marked As Answer by Eric Chen China Thursday, February 16, 2012 7:10 AM
-
Thursday, February 16, 2012 7:10 AM
thanks.
Server s = new Server(); s.Databases[0].MirroringPartner s.Databases[0].MirroringWitness select mirroring_partner_name,mirroring_witness_name from sys.database_mirroring
Works.thanks, eric
- Marked As Answer by Eric Chen China Thursday, February 16, 2012 7:11 AM

