Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql server always on backups

Status
Not open for further replies.

niall5098

IS-IT--Management
Jun 2, 2005
114
IE
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top