I configured Ola's scripts on a staging AG configuration to test out the logic. When I checked the backup folder today after a week, I see that the backups are happening both on the primary replica and copy_only backups on the secondary replica.
It is my understanding that the backups are supposed to happen on the secondary replica – And I have configured the AG to "Prefer secondary". I don't want the backups happening on both primary and secondary on this 2 node AG. What can be done for this to work? Please advise.
Best Answer
Validate that:
OverrideBackupPreference
set in the Ola cmd lineCheck your DBName. If I call
sys.fn_hadr_backup_is_preferred_replica
with a@DatabaseName
that does not exist on the instance it returns a 1. If you have validated all this and it still returns a 1 on both replicas then the issue is not the OLA scripts, the issue is your AG configuration.Community Wiki answer created from comments by IanG