Permalink
Browse files

Availability groups comments

  • Loading branch information...
gboge committed Oct 9, 2017
1 parent 2cf5a5f commit 6ffd47a2c0a97154812b2a4be926d2c2493e6e83
Showing with 35 additions and 1 deletion.
  1. +35 −1 KServer.cs
View
@@ -1663,6 +1663,11 @@ public static DataTable GetLiveLatchesProfiler(this smo.Server s)
#region Dashboard Availability Groups
/// <summary>
/// Get availability groups without distributed groups
/// </summary>
/// <param name="s">your smo server</param>
/// <returns>a DataTable</returns>
public static DataTable DashboardAG_GetAvailabilityGroups(this smo.Server s)
{
smo.Database d = s.Databases["master"];
@@ -1681,6 +1686,12 @@ FROM sys.availability_groups
return d.ExecuteWithResults(sql).Tables[0];
}
/// <summary>
/// Get database list for a given availability group
/// </summary>
/// <param name="s">your smo server</param>
/// <param name="groupId">availability group id. UniqueIdentifier</param>
/// <returns>a DataTable</returns>
public static DataTable DashboardAG_GetDatabases(this smo.Server s, string groupId)
{
smo.Database d = s.Databases["master"];
@@ -1691,6 +1702,12 @@ FROM sys.availability_databases_cluster
return d.ExecuteWithResults(sql).Tables[0];
}
/// <summary>
/// Get the replica list and its role for an availability group
/// </summary>
/// <param name="s">your smo server</param>
/// <param name="groupId">availability group id. UniqueIdentifier</param>
/// <returns>a DataTable</returns>
public static DataTable DashboardAG_GetReplica(this smo.Server s, string groupId)
{
smo.Database d = s.Databases["master"];
@@ -1736,7 +1753,12 @@ UNION ALL
return d.ExecuteWithResults(string.Format(sql, groupId)).Tables[0];
}
/// <summary>
/// Get the health state for each replica of an availability group
/// </summary>
/// <param name="s">your smo server</param>
/// <param name="groupId">availability group id. UniqueIdentifier</param>
/// <returns>a DataTable</returns>
public static DataTable DashboardAG_GetReplicasInfo(this smo.Server s, string groupId)
{
smo.Database d = s.Databases["master"];
@@ -1818,6 +1840,12 @@ AND EXISTS (SELECT * FROM sys.availability_groups g2 WHERE g2.name = gs.primary_
return d.ExecuteWithResults(string.Format(sql, groupId)).Tables[0];
}
/// <summary>
/// Get health status of each replica by database
/// </summary>
/// <param name="s">your smo server</param>
/// <param name="groupId">availability group id. UniqueIdentifier</param>
/// <returns>a DataTable</returns>
public static DataTable DashboardAG_GetDatabasesInfo(this smo.Server s, string groupId)
{
smo.Database d = s.Databases["master"];
@@ -1846,6 +1874,12 @@ public static DataTable DashboardAG_GetDatabasesInfo(this smo.Server s, string g
return d.ExecuteWithResults(string.Format(sql, groupId)).Tables[0];
}
/// <summary>
/// Get the primary replica name for a given availability group
/// </summary>
/// <param name="s">your smo server</param>
/// <param name="groupId">availability group id. UniqueIdentifier</param>
/// <returns>a DataTable</returns>
public static DataTable DashboardAG_GetPrimary(this smo.Server s, string groupId)
{
smo.Database d = s.Databases["master"];

0 comments on commit 6ffd47a

Please sign in to comment.