Availability Group backup preference not changing to primary The Next CEO of Stack OverflowAlwaysOn Availability Group Automatic Failover does not workReplicate a database to one secondary replica, but not the other secondary replica using Availability GroupScheduling backup jobs for an Availability GroupAny disadvantage to automatically changing FULL backup on AlwaysON Secondary to COPY_ONLY?SQL Server high availability fn_hadr_backup_is_preferred_replica returns 0 zero on secondaryOla Hallengren Index maintenance on servers with Availability GroupsOne Availability group, two primary nodesWhat impact does using backup preference on Availability Groups have?AlwaysOn Error: The target database is participating in an availability group and is currently not accessible for queriesBackup Plan on Always On using Maintenance Wizard doing Tlogs on Primary and Secondary

Legal workarounds for testamentary trust perceived as unfair

What does "Its cash flow is deeply negative" mean?

WOW air has ceased operation, can I get my tickets refunded?

The exact meaning of 'Mom made me a sandwich'

RigExpert AA-35 - Interpreting The Information

How to check if all elements of 1 list are in the *same quantity* and in any order, in the list2?

Flying from Cape Town to England and return to another province

Axiom Schema vs Axiom

TikZ: How to reverse arrow direction without switching start/end point?

Solving system of ODEs with extra parameter

Does increasing your ability score affect your main stat?

Is French Guiana a (hard) EU border?

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Why is information "lost" when it got into a black hole?

Why the difference in type-inference over the as-pattern in two similar function definitions?

I want to delete every two lines after 3rd lines in file contain very large number of lines :

How to get from Geneva Airport to Metabief, Doubs, France by public transport?

When you upcast Blindness/Deafness, do all targets suffer the same effect?

Rotate a column

Easy to read palindrome checker

Can this equation be simplified further?

Is it okay to majorly distort historical facts while writing a fiction story?

What happened in Rome, when the western empire "fell"?



Availability Group backup preference not changing to primary



The Next CEO of Stack OverflowAlwaysOn Availability Group Automatic Failover does not workReplicate a database to one secondary replica, but not the other secondary replica using Availability GroupScheduling backup jobs for an Availability GroupAny disadvantage to automatically changing FULL backup on AlwaysON Secondary to COPY_ONLY?SQL Server high availability fn_hadr_backup_is_preferred_replica returns 0 zero on secondaryOla Hallengren Index maintenance on servers with Availability GroupsOne Availability group, two primary nodesWhat impact does using backup preference on Availability Groups have?AlwaysOn Error: The target database is participating in an availability group and is currently not accessible for queriesBackup Plan on Always On using Maintenance Wizard doing Tlogs on Primary and Secondary










3















I have an availability group setup and I'm using Ola Hallengren backup scripts. At setup of the Availability group, the default option of Prefer Secondary was set, where it should have been changed to primary.



Once I noticed this, I tried to set the backup preference to Primary, but it doesn't change, it stays on Prefer Secondary.



Has anyone come across this before? I'm using the user interface (availability group wizard) to make the change.










share|improve this question









New contributor




Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Do you also have the "backup priority" setting configured? I've run into problems with that in our AAG. I.E. Set to "no preference", but primary still doesn't take a backup because secondary "priority" is set to "50" and primary was set to "48".

    – Jacob H
    yesterday











  • @JacobH thanks, one of my secondaries did have a different Priority due to it being on my DR site, so I lowered it but in the end i opted for the T-SQL option that chnaged it for me. ALTER AVAILABILITY GROUP [<AG NAME>] SET (AUTOMATED_BACKUP_PREFERENCE = PRIMARY)

    – Dennis Finke
    yesterday











  • Dennis, so we are clear, there are two settings that we're referring to, AUTOMATED_BACKUP_PREFERENCE and BACKUP_PRIORITY. Both are required to be configured for Ola's scripts to function. This is what I've found.

    – Jacob H
    yesterday
















3















I have an availability group setup and I'm using Ola Hallengren backup scripts. At setup of the Availability group, the default option of Prefer Secondary was set, where it should have been changed to primary.



Once I noticed this, I tried to set the backup preference to Primary, but it doesn't change, it stays on Prefer Secondary.



Has anyone come across this before? I'm using the user interface (availability group wizard) to make the change.










share|improve this question









New contributor




Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Do you also have the "backup priority" setting configured? I've run into problems with that in our AAG. I.E. Set to "no preference", but primary still doesn't take a backup because secondary "priority" is set to "50" and primary was set to "48".

    – Jacob H
    yesterday











  • @JacobH thanks, one of my secondaries did have a different Priority due to it being on my DR site, so I lowered it but in the end i opted for the T-SQL option that chnaged it for me. ALTER AVAILABILITY GROUP [<AG NAME>] SET (AUTOMATED_BACKUP_PREFERENCE = PRIMARY)

    – Dennis Finke
    yesterday











  • Dennis, so we are clear, there are two settings that we're referring to, AUTOMATED_BACKUP_PREFERENCE and BACKUP_PRIORITY. Both are required to be configured for Ola's scripts to function. This is what I've found.

    – Jacob H
    yesterday














3












3








3








I have an availability group setup and I'm using Ola Hallengren backup scripts. At setup of the Availability group, the default option of Prefer Secondary was set, where it should have been changed to primary.



Once I noticed this, I tried to set the backup preference to Primary, but it doesn't change, it stays on Prefer Secondary.



Has anyone come across this before? I'm using the user interface (availability group wizard) to make the change.










share|improve this question









New contributor




Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have an availability group setup and I'm using Ola Hallengren backup scripts. At setup of the Availability group, the default option of Prefer Secondary was set, where it should have been changed to primary.



Once I noticed this, I tried to set the backup preference to Primary, but it doesn't change, it stays on Prefer Secondary.



Has anyone come across this before? I'm using the user interface (availability group wizard) to make the change.







sql-server sql-server-2012 availability-groups ola-hallengren






share|improve this question









New contributor




Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday









Josh Darnell

7,38522241




7,38522241






New contributor




Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Dennis FinkeDennis Finke

161




161




New contributor




Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Dennis Finke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Do you also have the "backup priority" setting configured? I've run into problems with that in our AAG. I.E. Set to "no preference", but primary still doesn't take a backup because secondary "priority" is set to "50" and primary was set to "48".

    – Jacob H
    yesterday











  • @JacobH thanks, one of my secondaries did have a different Priority due to it being on my DR site, so I lowered it but in the end i opted for the T-SQL option that chnaged it for me. ALTER AVAILABILITY GROUP [<AG NAME>] SET (AUTOMATED_BACKUP_PREFERENCE = PRIMARY)

    – Dennis Finke
    yesterday











  • Dennis, so we are clear, there are two settings that we're referring to, AUTOMATED_BACKUP_PREFERENCE and BACKUP_PRIORITY. Both are required to be configured for Ola's scripts to function. This is what I've found.

    – Jacob H
    yesterday


















  • Do you also have the "backup priority" setting configured? I've run into problems with that in our AAG. I.E. Set to "no preference", but primary still doesn't take a backup because secondary "priority" is set to "50" and primary was set to "48".

    – Jacob H
    yesterday











  • @JacobH thanks, one of my secondaries did have a different Priority due to it being on my DR site, so I lowered it but in the end i opted for the T-SQL option that chnaged it for me. ALTER AVAILABILITY GROUP [<AG NAME>] SET (AUTOMATED_BACKUP_PREFERENCE = PRIMARY)

    – Dennis Finke
    yesterday











  • Dennis, so we are clear, there are two settings that we're referring to, AUTOMATED_BACKUP_PREFERENCE and BACKUP_PRIORITY. Both are required to be configured for Ola's scripts to function. This is what I've found.

    – Jacob H
    yesterday

















Do you also have the "backup priority" setting configured? I've run into problems with that in our AAG. I.E. Set to "no preference", but primary still doesn't take a backup because secondary "priority" is set to "50" and primary was set to "48".

– Jacob H
yesterday





Do you also have the "backup priority" setting configured? I've run into problems with that in our AAG. I.E. Set to "no preference", but primary still doesn't take a backup because secondary "priority" is set to "50" and primary was set to "48".

– Jacob H
yesterday













@JacobH thanks, one of my secondaries did have a different Priority due to it being on my DR site, so I lowered it but in the end i opted for the T-SQL option that chnaged it for me. ALTER AVAILABILITY GROUP [<AG NAME>] SET (AUTOMATED_BACKUP_PREFERENCE = PRIMARY)

– Dennis Finke
yesterday





@JacobH thanks, one of my secondaries did have a different Priority due to it being on my DR site, so I lowered it but in the end i opted for the T-SQL option that chnaged it for me. ALTER AVAILABILITY GROUP [<AG NAME>] SET (AUTOMATED_BACKUP_PREFERENCE = PRIMARY)

– Dennis Finke
yesterday













Dennis, so we are clear, there are two settings that we're referring to, AUTOMATED_BACKUP_PREFERENCE and BACKUP_PRIORITY. Both are required to be configured for Ola's scripts to function. This is what I've found.

– Jacob H
yesterday






Dennis, so we are clear, there are two settings that we're referring to, AUTOMATED_BACKUP_PREFERENCE and BACKUP_PRIORITY. Both are required to be configured for Ola's scripts to function. This is what I've found.

– Jacob H
yesterday











1 Answer
1






active

oldest

votes


















2















I tried to set the backup preference to Primary but it doesn't change, it stays on Prefer Secondary




I'm not sure if you mean the user interface, or if the actual effect of the change didn't occur as you expected. My answer assumes the latter.



To be clear about something that I find a little confusing: this setting is not something that automatically affects how backups are run. It's simply a place where you, as a DBA, can store "metadata" about how you prefer backups to be taken.



This is documented, but it's not obvious at all from the user interface. Here's the quote from the docs:




❕ Important



There is no enforcement of the AUTOMATED_BACKUP_PREFERENCE setting. The interpretation of this preference depends on the logic, if any, that you script into back jobs for the databases in a given availability group. The automated backup preference setting has no impact on ad hoc backups.




After setting this, you need to update your backup jobs with code like this (also lifted from the docs):



IF (NOT sys.fn_hadr_backup_is_preferred_replica(@DBNAME)) 
BEGIN
Select 'This is not the preferred replica, exiting with success';
RETURN 0 - This is a normal, expected condition, so the script returns success
END
BACKUP DATABASE @DBNAME TO DISK=<disk>
WITH COPY_ONLY;


Using sp_helptext to view the source of sys.fn_hadr_backup_is_preferred_replica, it can be seen that this takes into account both the AG-level AUTOMATED_BACKUP_PREFERENCE setting, and the replica-level BACKUP_PRIORITY setting.



Note: since you're using Ola's scripts, this is already taken into account




If you just didn't see the value change in the user interface, I would suggest using the "script" button to show the T-SQL that's being run by the UI, and then running that script manually to see if the change is properly made.






share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "182"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Dennis Finke is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f233484%2favailability-group-backup-preference-not-changing-to-primary%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2















    I tried to set the backup preference to Primary but it doesn't change, it stays on Prefer Secondary




    I'm not sure if you mean the user interface, or if the actual effect of the change didn't occur as you expected. My answer assumes the latter.



    To be clear about something that I find a little confusing: this setting is not something that automatically affects how backups are run. It's simply a place where you, as a DBA, can store "metadata" about how you prefer backups to be taken.



    This is documented, but it's not obvious at all from the user interface. Here's the quote from the docs:




    ❕ Important



    There is no enforcement of the AUTOMATED_BACKUP_PREFERENCE setting. The interpretation of this preference depends on the logic, if any, that you script into back jobs for the databases in a given availability group. The automated backup preference setting has no impact on ad hoc backups.




    After setting this, you need to update your backup jobs with code like this (also lifted from the docs):



    IF (NOT sys.fn_hadr_backup_is_preferred_replica(@DBNAME)) 
    BEGIN
    Select 'This is not the preferred replica, exiting with success';
    RETURN 0 - This is a normal, expected condition, so the script returns success
    END
    BACKUP DATABASE @DBNAME TO DISK=<disk>
    WITH COPY_ONLY;


    Using sp_helptext to view the source of sys.fn_hadr_backup_is_preferred_replica, it can be seen that this takes into account both the AG-level AUTOMATED_BACKUP_PREFERENCE setting, and the replica-level BACKUP_PRIORITY setting.



    Note: since you're using Ola's scripts, this is already taken into account




    If you just didn't see the value change in the user interface, I would suggest using the "script" button to show the T-SQL that's being run by the UI, and then running that script manually to see if the change is properly made.






    share|improve this answer





























      2















      I tried to set the backup preference to Primary but it doesn't change, it stays on Prefer Secondary




      I'm not sure if you mean the user interface, or if the actual effect of the change didn't occur as you expected. My answer assumes the latter.



      To be clear about something that I find a little confusing: this setting is not something that automatically affects how backups are run. It's simply a place where you, as a DBA, can store "metadata" about how you prefer backups to be taken.



      This is documented, but it's not obvious at all from the user interface. Here's the quote from the docs:




      ❕ Important



      There is no enforcement of the AUTOMATED_BACKUP_PREFERENCE setting. The interpretation of this preference depends on the logic, if any, that you script into back jobs for the databases in a given availability group. The automated backup preference setting has no impact on ad hoc backups.




      After setting this, you need to update your backup jobs with code like this (also lifted from the docs):



      IF (NOT sys.fn_hadr_backup_is_preferred_replica(@DBNAME)) 
      BEGIN
      Select 'This is not the preferred replica, exiting with success';
      RETURN 0 - This is a normal, expected condition, so the script returns success
      END
      BACKUP DATABASE @DBNAME TO DISK=<disk>
      WITH COPY_ONLY;


      Using sp_helptext to view the source of sys.fn_hadr_backup_is_preferred_replica, it can be seen that this takes into account both the AG-level AUTOMATED_BACKUP_PREFERENCE setting, and the replica-level BACKUP_PRIORITY setting.



      Note: since you're using Ola's scripts, this is already taken into account




      If you just didn't see the value change in the user interface, I would suggest using the "script" button to show the T-SQL that's being run by the UI, and then running that script manually to see if the change is properly made.






      share|improve this answer



























        2












        2








        2








        I tried to set the backup preference to Primary but it doesn't change, it stays on Prefer Secondary




        I'm not sure if you mean the user interface, or if the actual effect of the change didn't occur as you expected. My answer assumes the latter.



        To be clear about something that I find a little confusing: this setting is not something that automatically affects how backups are run. It's simply a place where you, as a DBA, can store "metadata" about how you prefer backups to be taken.



        This is documented, but it's not obvious at all from the user interface. Here's the quote from the docs:




        ❕ Important



        There is no enforcement of the AUTOMATED_BACKUP_PREFERENCE setting. The interpretation of this preference depends on the logic, if any, that you script into back jobs for the databases in a given availability group. The automated backup preference setting has no impact on ad hoc backups.




        After setting this, you need to update your backup jobs with code like this (also lifted from the docs):



        IF (NOT sys.fn_hadr_backup_is_preferred_replica(@DBNAME)) 
        BEGIN
        Select 'This is not the preferred replica, exiting with success';
        RETURN 0 - This is a normal, expected condition, so the script returns success
        END
        BACKUP DATABASE @DBNAME TO DISK=<disk>
        WITH COPY_ONLY;


        Using sp_helptext to view the source of sys.fn_hadr_backup_is_preferred_replica, it can be seen that this takes into account both the AG-level AUTOMATED_BACKUP_PREFERENCE setting, and the replica-level BACKUP_PRIORITY setting.



        Note: since you're using Ola's scripts, this is already taken into account




        If you just didn't see the value change in the user interface, I would suggest using the "script" button to show the T-SQL that's being run by the UI, and then running that script manually to see if the change is properly made.






        share|improve this answer
















        I tried to set the backup preference to Primary but it doesn't change, it stays on Prefer Secondary




        I'm not sure if you mean the user interface, or if the actual effect of the change didn't occur as you expected. My answer assumes the latter.



        To be clear about something that I find a little confusing: this setting is not something that automatically affects how backups are run. It's simply a place where you, as a DBA, can store "metadata" about how you prefer backups to be taken.



        This is documented, but it's not obvious at all from the user interface. Here's the quote from the docs:




        ❕ Important



        There is no enforcement of the AUTOMATED_BACKUP_PREFERENCE setting. The interpretation of this preference depends on the logic, if any, that you script into back jobs for the databases in a given availability group. The automated backup preference setting has no impact on ad hoc backups.




        After setting this, you need to update your backup jobs with code like this (also lifted from the docs):



        IF (NOT sys.fn_hadr_backup_is_preferred_replica(@DBNAME)) 
        BEGIN
        Select 'This is not the preferred replica, exiting with success';
        RETURN 0 - This is a normal, expected condition, so the script returns success
        END
        BACKUP DATABASE @DBNAME TO DISK=<disk>
        WITH COPY_ONLY;


        Using sp_helptext to view the source of sys.fn_hadr_backup_is_preferred_replica, it can be seen that this takes into account both the AG-level AUTOMATED_BACKUP_PREFERENCE setting, and the replica-level BACKUP_PRIORITY setting.



        Note: since you're using Ola's scripts, this is already taken into account




        If you just didn't see the value change in the user interface, I would suggest using the "script" button to show the T-SQL that's being run by the UI, and then running that script manually to see if the change is properly made.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday

























        answered yesterday









        Josh DarnellJosh Darnell

        7,38522241




        7,38522241




















            Dennis Finke is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Dennis Finke is a new contributor. Be nice, and check out our Code of Conduct.












            Dennis Finke is a new contributor. Be nice, and check out our Code of Conduct.











            Dennis Finke is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Database Administrators Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f233484%2favailability-group-backup-preference-not-changing-to-primary%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

            Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

            What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company