Backup on Distributed AG setup
I have setup a distibruted availability group and trying to understand behaviour of backups on it. While I can take backup from primary replica of Primary AG, I can not take backup from primary replica from Secondary(Forwarder) AG. https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/active-secondaries-backup-on-secondary-replicas-always-on-availability-groups?view=sql-server-ver16#SupportedBuTypes says I should be able to.
In a distributed availability group, backups can be performed on secondary replicas in the same availability group as the active primary replica, or on the primary replica of any secondary availability groups. Backups cannot be performed on a secondary replica in a secondary availability group because secondary replicas only communicate with the primary replica in their own availability group. Only replicas that communicate directly with the global primary replica can perform backup operations.
BACKUP DATABASE [mydb] TO DISK = 'C:\TEMP\mydb_Full.BAK' WITH COMPRESSION
Error I am getting is -
Msg 3059, Level 16, State 1, Line 1 This BACKUP or RESTORE command is not supported on a database mirror or secondary replica. Msg 3013, Level 16, State 1, Line 1 BACKUP DATABASE is terminating abnormally.
Is this bug or I am misunderstanding something?
Backup preference is set to 'Primary' on both AG.
returns '1' on primary replicas of both Availability groups.
from the link you provided:
BACKUP DATABASE supports only copy-only full backups of databases, files, or filegroups when it's executed on secondary replicas. Copy-only backups don't impact the log chain or clear the differential bitmap.