Wednesday, February 15, 2012 1:43 AMSMO-how to get the mirror server of a database? SQL server 2008 R2
Thursday, February 16, 2012 4:27 AMModerator
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.
TechNet Community Support
- Marked As Answer by Eric Chen China Thursday, February 16, 2012 7:10 AM
Thursday, February 16, 2012 7:10 AM
Server s = new Server(); s.Databases.MirroringPartner s.Databases.MirroringWitness select mirroring_partner_name,mirroring_witness_name from sys.database_mirroring
- Marked As Answer by Eric Chen China Thursday, February 16, 2012 7:11 AM