I am getting the below error while executing the script for taking filegroup backups from a secondary replica.
Msg 3059, Level 16, State 1, Line 18
This BACKUP or RESTORE command is not supported on a database mirror or secondary replica.Msg 3013, Level 16, State 1, Line 18
BACKUP DATABASE is terminating abnormally.
Script being used:
BACKUP DATABASE [DBName] FILEGROUP = N'PRIMARY'
TO DISK = 'E:\Backups\PRIMARY.bak'
WITH NAME = 'PRIMARY', COPY_ONLY, NOFORMAT, NOINIT, SKIP, REWIND, NOUNLOAD, STATS = 50