SQL Server 2016 – How to Remove Read-Only Routing URL

availability-groupssql-server-2016

How can I remove the Read-Only Routing URL in an availability group.

I have set the Read-Only routing URL and I'm trying to get it back to how it was before my test and I can't find a way to remove those URL.

I tried with :
ALTER AVAILABILITY GROUP [AG1]
MODIFY REPLICA ON
N'COMPUTER01' WITH
(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N''));
but SQL does not allow an empty value here.

Thank you for you precious help.

Best Answer

There is no method for deleting a read only routing URL for a given replica. Your only options are to change the URL to something else (just putting a different URL in the READ_ONLY_ROUTING_URL = N'tcp://newRoutingString' or dropping the replica entirely from the AG and putting it back in again (less than ideal I know).

If you adjust the replica to SECONDARY_ROLE(ALLOW_CONNECTIONS = NONE) then you can at least prevent any potential attempts to hit that URL.