You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--On a secondary replica, this view returns a row for every secondary database on the server instance.
2
+
--On the primary replica, this view returns a row for each primary database and an additional row for the corresponding secondary database.
3
+
4
+
--Updated WDA 20170622
5
+
6
+
IFNOTEXISTS (
7
+
SELECT@@SERVERNAME, *
8
+
FROMsys.dm_hadr_availability_replica_states rs
9
+
inner joinsys.availability_databases_cluster dc
10
+
onrs.group_id=dc.group_id
11
+
WHERE is_local =1
12
+
and role_desc ='PRIMARY'
13
+
)
14
+
SELECT'Recommend: Run This Script on Primary Replica';
15
+
16
+
17
+
declare @start_tick bigint, @start_cntr bigint
18
+
19
+
select @start_tick =MAX(ms_ticks), @start_cntr =MAX(cntr_value) --the availability database with the highest Tdata_loss becomes the limiting value for RPO compliance.
select @end_tick =MAX(ms_ticks), @end_cntr =MAX(cntr_value) --the availability database with the highest Tdata_loss becomes the limiting value for RPO compliance.
, Redo_Time_Left_s_RTO =dm.redo_queue_size/NULLIF(dm.redo_rate,0) --https://msdn.microsoft.com/en-us/library/dn135338(v=sql.110).aspx --only part of RTO
where [object_name] like'%Availability Replica%'and instance_name <>'_Total'and
14
+
( counter_name ='Bytes Received from Replica/sec'--From the availability replica. Pings and status updates will generate network traffic even on databases with no user updates.
15
+
or counter_name ='Bytes Sent to Replica/sec'--Sent to the remote replica. On primary, sent to the secondary replica. On secondary, sent to the primary replica.
16
+
or counter_name ='Bytes Sent to Transport/sec'--Sent over the network to the remote replica. On primary, sent to the secondary replica. On secondary, sent to the primary replica.
17
+
or counter_name ='Flow Control Time (ms/sec)'--Time in milliseconds that log stream messages waited for send flow control, in the last second.
where [object_name] like'%Availability Replica%'and instance_name <>'_Total'and
41
+
( counter_name ='Bytes Received from Replica/sec'--From the availability replica. Pings and status updates will generate network traffic even on databases with no user updates.
42
+
or counter_name ='Bytes Sent to Replica/sec'--Sent to the remote replica. On primary, sent to the secondary replica. On secondary, sent to the primary replica.
43
+
or counter_name ='Bytes Sent to Transport/sec'--Sent over the network to the remote replica. On primary, sent to the secondary replica. On secondary, sent to the primary replica.
44
+
or counter_name ='Flow Control Time (ms/sec)'--Time in milliseconds that log stream messages waited for send flow control, in the last second.
where object_name like '%Availability Replica%' and instance_name <> '_Total' and
71
+
( counter_name = 'Bytes Received from Replica/sec' --From the availability replica. Pings and status updates will generate network traffic even on databases with no user updates.
72
+
or counter_name = 'Bytes Sent to Replica/sec' --Sent to the remote replica. On primary, sent to the secondary replica. On secondary, sent to the primary replica.
73
+
or counter_name = 'Bytes Sent to Transport/sec' --Sent over the network to the remote replica. On primary, sent to the secondary replica. On secondary, sent to the primary replica.
74
+
or counter_name = 'Flow Control Time (ms/sec)' --Time in milliseconds that log stream messages waited for send flow control, in the last second.
75
+
or counter_name = 'Receives from Replica/Sec'
76
+
or counter_name = 'Sends to Replica/Sec'
77
+
78
+
)
79
+
80
+
81
+
--Only valid for databases in the secondary replica role
0 commit comments