• TimC-690839 (5/13/2013)


    I'm setting up my first pair of Sql 2012 servers using AlwaysOn. I set up backups to run on the primary and I understand that you can set up backups to run on both the primary and secondary servers but the secondary will fail. Is there a way I can stop the secondary server from sending out error messages about failed backups? Is it possible to script it so that the server looks at whether it's primary or secondary and turns on or off alerts based on that?

    Thanks for any help in advance.

    -tim

    Take a look at -

    http://msdn.microsoft.com/en-us/library/hh245119.aspx

    You can use sys.fn_hadr_backup_is_preferred_replica; i.e.

    If sys.fn_hadr_backup_is_preferred_replica( @dbname ) <> 1

    BEGIN

    -- If this is not the preferred replica, exit (probably without error).

    END

    -- If this is the preferred replica, continue to do the backup.