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
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
New contributor
add a comment |
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
New contributor
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
add a comment |
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
New contributor
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
sql-server sql-server-2012 availability-groups ola-hallengren
New contributor
New contributor
edited yesterday
Josh Darnell
7,38522241
7,38522241
New contributor
asked yesterday
Dennis FinkeDennis Finke
161
161
New contributor
New contributor
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
edited yesterday
answered yesterday
Josh DarnellJosh Darnell
7,38522241
7,38522241
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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