Issue :
SQL Server replication distribution job is failing with error " The process could not connect to Distributor 'server\instance' "
Cause : There can be different reasons for the error.
Possible causes :
-> SQL Distributor server is not running, Distributor DB is not online,
-> Distribution agent service account does not have sufficient access to Distributor DB
-> SQL Distribution instance is not reachable
-> Distributor to publisher linked server not working
Solution :
In our case, distributor agent is running on subscriber end as its pull replication. We started verifying distribution DB SQL instance status and DB status, both verified to be up and running.
Verified distribution agent account is having sufficient access to authenticate distributor DB SQL instance.
Verified Distributor to publisher linked server connection is fine.
However when we tried to connect distributor instance from subscriber side, connection failed. We observed distributor instance is running on non default port (for example 6789). But when we tried to connect with explicit port number the connection is successful.
We made sure SQL browser running as SQL port is non default. So the next step we tried to check the SQL browser service port 1434 connectivity between distributor and subscriber server which was closed.
Hence we have got the port opened between the servers and distribution job started running fine.
Another workaround, if port 1434 is not open and server is running on non default port then you can edit your distributor job properties to explicitly port.
For example :
-Subscriber [SubscriberServerName\instance] -SubscriberDB [SubscriberDBName] -subscribersecuritymode 1 -Publisher [PublisherServerName\instance] -Publication [PublicationName] -PublisherDB [PublisherDBName] -SubscriptionType 1 -Distributor [DistributorServerName\instance,6789] -DistributorSecurityMode 1 optional_command_line