What impact does using backup preference on Availability Groups have?












0















I am using Availability Groups (database level) SQL Server 2017:



I have set my availability group to "prefer secondary". I have allowed read access on replica.
I have created a maintenance plan with full backups on all databases on replica using "copy only" and then also on primary.



But now I'm wondering does AG actually make any decisions? Both Mainenance plans will run and from what I can tell won't change "copy only" to primary's maintenance plan if there's a failover.



Besides just preventing me from running backups if I change the setting..... besides enforcing rules for what [another] dba may or may not be able to do: what is the point of this?



Or, did I setup my backups totally wrong?










share|improve this question



























    0















    I am using Availability Groups (database level) SQL Server 2017:



    I have set my availability group to "prefer secondary". I have allowed read access on replica.
    I have created a maintenance plan with full backups on all databases on replica using "copy only" and then also on primary.



    But now I'm wondering does AG actually make any decisions? Both Mainenance plans will run and from what I can tell won't change "copy only" to primary's maintenance plan if there's a failover.



    Besides just preventing me from running backups if I change the setting..... besides enforcing rules for what [another] dba may or may not be able to do: what is the point of this?



    Or, did I setup my backups totally wrong?










    share|improve this question

























      0












      0








      0








      I am using Availability Groups (database level) SQL Server 2017:



      I have set my availability group to "prefer secondary". I have allowed read access on replica.
      I have created a maintenance plan with full backups on all databases on replica using "copy only" and then also on primary.



      But now I'm wondering does AG actually make any decisions? Both Mainenance plans will run and from what I can tell won't change "copy only" to primary's maintenance plan if there's a failover.



      Besides just preventing me from running backups if I change the setting..... besides enforcing rules for what [another] dba may or may not be able to do: what is the point of this?



      Or, did I setup my backups totally wrong?










      share|improve this question














      I am using Availability Groups (database level) SQL Server 2017:



      I have set my availability group to "prefer secondary". I have allowed read access on replica.
      I have created a maintenance plan with full backups on all databases on replica using "copy only" and then also on primary.



      But now I'm wondering does AG actually make any decisions? Both Mainenance plans will run and from what I can tell won't change "copy only" to primary's maintenance plan if there's a failover.



      Besides just preventing me from running backups if I change the setting..... besides enforcing rules for what [another] dba may or may not be able to do: what is the point of this?



      Or, did I setup my backups totally wrong?







      availability-groups






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 20 '18 at 16:12









      DinaDina

      74721836




      74721836






















          1 Answer
          1






          active

          oldest

          votes


















          0














          No, the availability group does not do anything to control where backups occur. The backup preference settings on an availability group are there so that the backup software can reference it to determine where to run the backup. If the backup software in use doesn't have any code to reference these settings, they will have no impact on that backup software and it will just run the backups on the server it connects to.



          Most backup software that supports availability groups will reference the backup preference configuration and take backups accordingly. Maintenance Plan backups will adhere to the backup preference configured on the availability group.



          One option I would recommend for the copy-only backup setup--create your SQL Agent job to run a copy-only backup. The first step in the job would be to check if the server is the primary, and if so, end the job. If it is not the primary, then run the copy-only backup.



          The first step of the job can use the fn_hadr_is_primary_replica function to determine if the server is the primary of a given database:



          sys.fn_hadr_is_primary_replica ( 'dbname' )


          See sys.fn_hadr_is_primary_replica (Transact-SQL).






          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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f204543%2fwhat-impact-does-using-backup-preference-on-availability-groups-have%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









            0














            No, the availability group does not do anything to control where backups occur. The backup preference settings on an availability group are there so that the backup software can reference it to determine where to run the backup. If the backup software in use doesn't have any code to reference these settings, they will have no impact on that backup software and it will just run the backups on the server it connects to.



            Most backup software that supports availability groups will reference the backup preference configuration and take backups accordingly. Maintenance Plan backups will adhere to the backup preference configured on the availability group.



            One option I would recommend for the copy-only backup setup--create your SQL Agent job to run a copy-only backup. The first step in the job would be to check if the server is the primary, and if so, end the job. If it is not the primary, then run the copy-only backup.



            The first step of the job can use the fn_hadr_is_primary_replica function to determine if the server is the primary of a given database:



            sys.fn_hadr_is_primary_replica ( 'dbname' )


            See sys.fn_hadr_is_primary_replica (Transact-SQL).






            share|improve this answer




























              0














              No, the availability group does not do anything to control where backups occur. The backup preference settings on an availability group are there so that the backup software can reference it to determine where to run the backup. If the backup software in use doesn't have any code to reference these settings, they will have no impact on that backup software and it will just run the backups on the server it connects to.



              Most backup software that supports availability groups will reference the backup preference configuration and take backups accordingly. Maintenance Plan backups will adhere to the backup preference configured on the availability group.



              One option I would recommend for the copy-only backup setup--create your SQL Agent job to run a copy-only backup. The first step in the job would be to check if the server is the primary, and if so, end the job. If it is not the primary, then run the copy-only backup.



              The first step of the job can use the fn_hadr_is_primary_replica function to determine if the server is the primary of a given database:



              sys.fn_hadr_is_primary_replica ( 'dbname' )


              See sys.fn_hadr_is_primary_replica (Transact-SQL).






              share|improve this answer


























                0












                0








                0







                No, the availability group does not do anything to control where backups occur. The backup preference settings on an availability group are there so that the backup software can reference it to determine where to run the backup. If the backup software in use doesn't have any code to reference these settings, they will have no impact on that backup software and it will just run the backups on the server it connects to.



                Most backup software that supports availability groups will reference the backup preference configuration and take backups accordingly. Maintenance Plan backups will adhere to the backup preference configured on the availability group.



                One option I would recommend for the copy-only backup setup--create your SQL Agent job to run a copy-only backup. The first step in the job would be to check if the server is the primary, and if so, end the job. If it is not the primary, then run the copy-only backup.



                The first step of the job can use the fn_hadr_is_primary_replica function to determine if the server is the primary of a given database:



                sys.fn_hadr_is_primary_replica ( 'dbname' )


                See sys.fn_hadr_is_primary_replica (Transact-SQL).






                share|improve this answer













                No, the availability group does not do anything to control where backups occur. The backup preference settings on an availability group are there so that the backup software can reference it to determine where to run the backup. If the backup software in use doesn't have any code to reference these settings, they will have no impact on that backup software and it will just run the backups on the server it connects to.



                Most backup software that supports availability groups will reference the backup preference configuration and take backups accordingly. Maintenance Plan backups will adhere to the backup preference configured on the availability group.



                One option I would recommend for the copy-only backup setup--create your SQL Agent job to run a copy-only backup. The first step in the job would be to check if the server is the primary, and if so, end the job. If it is not the primary, then run the copy-only backup.



                The first step of the job can use the fn_hadr_is_primary_replica function to determine if the server is the primary of a given database:



                sys.fn_hadr_is_primary_replica ( 'dbname' )


                See sys.fn_hadr_is_primary_replica (Transact-SQL).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 11 mins ago









                Tony HinkleTony Hinkle

                2,3631422




                2,3631422






























                    draft saved

                    draft discarded




















































                    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%2f204543%2fwhat-impact-does-using-backup-preference-on-availability-groups-have%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

                    ف. موراي أبراهام

                    صرب

                    كأس إنترتوتو