If a failover happened, how can I delete old backups from the Copy_only folder? Because the Copy only folder exists on the primary server, and backups are running without copy_only. Please resolve my issue and let me know the solution.
I believe you may be asking how to change the backups so that they occur in a directory other than the Copy_only directory. If so, here is some information to get started with which you can then search for. Hope this helps.
Using SQL Server Management Studio
To configure backup on secondary replicas
In Object Explorer, connect to the server instance that hosts the primary replica, and click the server name to expand the server tree.
Expand the Always On High Availability node and the Availability Groups node.
Click the availability group whose backup preferences you want to configure, and select the Properties command.
In the Availability Group Properties dialog box, select Backup Preferences page.
On the Where should backups occur? panel, select the automated backup preference for the availability group, one of:
Prefer Secondary Specifies that backups should occur on a secondary replica except when the primary replica is the only replica online. In that case, the backup should occur on the primary replica. This is the default option.
Secondary only Specifies that backups should never be performed on the primary replica. If the primary replica is the only replica online, the backup should not occur.
Primary Specifies that the backups should always occur on the primary replica. This option is useful if you need backup features, such as creating differential backups, that are not supported when backup is run on a secondary replica.
Important If you plan to use log shipping to prepare any secondary databases for an availability group, set the automated backup preference to Primary until all the secondary databases have been prepared and joined to the availability group.
Any Replica Specifies that you prefer that backup jobs ignore the role of the availability replicas when choosing the replica to perform backups. Note backup jobs might evaluate other factors such as backup priority of each availability replica in combination with its operational state and connected state.
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 backup jobs for the databases in a given availability group. The automated backup preference setting has no impact on ad-hoc backups. For more information, see see Follow Up: After Configuring Backup on Secondary Replicas later in this topic.
Use the Replica backup priorities grid to change the backup priority of the availability replicas. This grid displays the current backup priority of each server instance that hosts a replica for the availability group. The grid columns are as follows:
Server Instance The name of the instance of SQL Server that hosts the availability replica.
Backup Priority (Lowest=1, Highest=100) Specifies your priority for performing backups on this replica relative to the other replicas in the same availability group. The value is an integer in the range of 0..100. 1 indicates the lowest priority, and 100 indicates the highest priority. If Backup Priority = 1, the availability replica would be chosen for performing backups only if no higher priority availability replicas are currently available.
Exclude Replica Select if you never want this availability replica to be chosen for performing backups. This is useful, for example, for a remote availability replica to which you never want backups to fail over.
To commit your changes, click OK.