HI ALL,
I am trying to configure backups for an always on 2 node cluster.
in my job setup i have a job for each backup that runs and checks to see if the database on that node is the primary or the secondary, code below:
DECLARE @preferredReplica int
SET @preferredReplica = (SELECT [master].sys.fn_hadr_backup_is_preferred_replica('[DBNAME]'))
IF (@preferredReplica = 1)
begin
EXEC MSDB.dbo.sp_start_job @Job_Name = 'V1_UserDB_Backup.SPBackup'
end
However my issue is that when i run the SELECT [master].sys.fn_hadr_backup_is_preferred_replica('[DBNAME]') statement on both nodes, they both return 1. i would expect a 0 for one node.
anyone know why this might the case or a workaround?
Thanks in advance,
Niall
I am trying to configure backups for an always on 2 node cluster.
in my job setup i have a job for each backup that runs and checks to see if the database on that node is the primary or the secondary, code below:
DECLARE @preferredReplica int
SET @preferredReplica = (SELECT [master].sys.fn_hadr_backup_is_preferred_replica('[DBNAME]'))
IF (@preferredReplica = 1)
begin
EXEC MSDB.dbo.sp_start_job @Job_Name = 'V1_UserDB_Backup.SPBackup'
end
However my issue is that when i run the SELECT [master].sys.fn_hadr_backup_is_preferred_replica('[DBNAME]') statement on both nodes, they both return 1. i would expect a 0 for one node.
anyone know why this might the case or a workaround?
Thanks in advance,
Niall