Sunday , November 10 2024

Unable to access the ‘database_name’ database because no online secondary replicas are enabled for read-only access

ERROR:

Error: Microsoft ODBC Driver 11 for SQL Server : Unable to access the ‘database_name’ database because no online secondary replicas are enabled for read-only access. Check the availability group configuration to verify that at least one secondary replica is configured for read-only access. Wait for an enabled replica to come online, and retry your read-only operation.

EXPLANATION:

This error may occur when you trying to connect to a ReadIntent Only Readable Secondary server through an AlwaysOn Availability Group Listener.

SOLUTION:

If this error has occured, make sure that the SQL Server service of the Readable Secondary server that you set as ReadIntent Only in the AlwaysOn Availability Group is running, that the ports are open, and that this server is accessible. If you do not have a server that you set as ReadIntent Only in your AlwaysOn Availability Group, then make sure that there is no parameter like “ApplicationIntent = ReadOnly” in the Connection String of the application that this user is using. If this application is SQLCMD, this parameter will be “-K ReadOnly”.

Loading

About Ekrem Önsoy

The original article was written in Turkish by Ekrem Önsoy and translated to English by dbtut with the consent of the author. The copyright of the article belongs to the author. The author shall not be liable in any way for any defect caused by translation.

Leave a Reply

Your email address will not be published. Required fields are marked *