开发者

Programmatically detect which SQL Server is principal,which is the mirror?

I am looking for a way to programmatically query which SQL server is serving as the principal SQL server and which one is the mirror in a pair. Does anyone know if t开发者_运维问答his is possible via PowerShell (SQLPS) or CMD (SQLCMD)? If so, how can I go about querying this info?

Thanks in advance!


I don't have an instance handy to test with, but I think you should be able to query sys.database_mirroring_witnesses (SQL Server 2005 or later) using SQLCMD to get at the information you are looking for.

EDIT
Thanks to @Remus for the great comment. The appropriate place to look is in sys.database_mirroring.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜