execute job only on primary replica ( R/W) of Azure SQL MI failover groups
1
vote
1
answer
77
views
I am trying to setup SQL agent job that will only execute if it is primary replica of Azure SQL MI of failover groups.
I am trying to get primary replica using
sys.dm_hadr_database_replica_states
where is_primary_replica =1
but when I run it on SQL MI in different region , it also returns value 1.
I am using dbo.fn_hadr_group_is_primary(@AGName)=1
function for on-prem so looking for something similar for Azure SQL MI.
Asked by SqlDBA
(171 rep)
Feb 19, 2025, 02:12 PM
Last activity: Feb 24, 2025, 03:48 PM
Last activity: Feb 24, 2025, 03:48 PM