I have two node SQL Server 2019 enterprise evaluation Read Scale Availability Groups
( Cluster less AGs in redhat linux 8)
during Forced manual failover with data loss
when the primary replica isn't available and can't be recovered.
To force failover with data loss, I have connect to the secondary SQL Server instance and run the following command:
ALTER AVAILABILITY GROUP [dbag] FORCE_FAILOVER_ALLOW_DATA_LOSS;
secondary replica become primary & it is working perfectly.
When the previous primary replica recovers, it will also assume the primary role. To ensure that the previous primary replica transitions into a secondary role I have run the command on the previous primary replica.
ALTER AVAILABILITY GROUP [dbag] SET (ROLE = SECONDARY);
it is showing below error:
Msg 41104, Level 16, State 5, Line 43
Failover of the availability group 'dbag' to the local replica failed because the availability group resource did not come online due to a previous error. To identify that error, check the SQL Server error log, cluster logs and system event logs. For information about how to view events and logs for a Windows Server Failover Clustering (WSFC) cluster, see Windows Server documentation.
How to resolve the issue.