Sql-server – SQL server AlwaysOn alternate option for readintent=true

availability-groupssql serversql-server-2016

I know applications need certain(newest) version of ODBC drivers to connect an AlwaysOn SQL instance replica and to use the option "applicationIntent= readonly"

Now my question is , if some application don't have have these newest drivers and I(DBA) want to block this application's read only connections to primary and want the readonly requests of this application always routes to a AlwaysOn secondary replica then how this can achieved without "applicationIntent= readonly" option? Does anyone have any handy script to achieve this?

Best Answer

I(DBA) want to block this application's read only connections to primary and want the readonly requests of this application always routes to a AlwaysOn secondary replica then how this can achieved without "applicationIntent= readonly" option?

The simple solution is to configure the application to connect directly to the host hosting the secondary replica. The downside is that if the secondary is offline, the application won't be able to connect.

Alternatively, if your SQL Instances are standalone instances configured to listen on all IPs (the default), you can add an additional Client Access Point (ie a Network Name and an IP Address), to the cluster in a new Application (Cluster Resource Group), and configure the preferred owners of the group, and/or the possible owners of the Client Access Point to control which node the the new Client Access Point run on. The application would be configured to connect to the Network Name, which could fail over to some node if the preferred owner node is offline.