Open Matticusau opened 6 years ago
Try and work on this for next version to include a better summary
SELECT
CONVERT(DATE, autos.start_time) [start_date]
, ag.name [ag_name]
, db.database_name
, autos.current_state
, COUNT(autos.current_state) [count]
FROM sys.dm_hadr_automatic_seeding autos
JOIN sys.availability_databases_cluster db
ON autos.ag_db_id = db.group_database_id
JOIN sys.availability_groups ag
ON autos.ag_id = ag.group_id
GROUP BY CONVERT(DATE, autos.start_time)
, ag.name
, db.database_name
, autos.current_state
Some working queries for further exploration
SELECT
CONVERT(DATE, autos.start_time) [start_date]
-- , ag.name [ag_name]
-- , db.database_name
, autos.current_state
-- , autos.number_of_attempts
, SUM(autos.number_of_attempts) [total_attempts]
FROM sys.dm_hadr_automatic_seeding autos
JOIN sys.availability_databases_cluster db
ON autos.ag_db_id = db.group_database_id
JOIN sys.availability_groups ag
ON autos.ag_id = ag.group_id
--WHERE autos.current_state = 'FAILED'
--AND autos.failure_state <> 21 --Seeding Check Message Timeout
GROUP BY CONVERT(DATE, autos.start_time)
, ag.name
, db.database_name
, autos.current_state
--, autos.number_of_attempts
select autos.*
FROM sys.dm_hadr_automatic_seeding autos
JOIN sys.availability_databases_cluster db
ON autos.ag_db_id = db.group_database_id
JOIN sys.availability_groups ag
ON autos.ag_id = ag.group_id
Add an insight for autoseeding based on this existing SQL I wrote https://github.com/Microsoft/DataInsightsAsia/blob/Dev/Scripts/AlwaysOn/AutomaticSeeding.sql