Bobcares

SQL Server Error 35250 – How to resolve

by | Mar 5, 2022

Wondering how to resolve SQL Server Error 35250? We can help you.

At Bobcares, we offer solutions for every query, big and small, as a part of our Microsoft SQL Server Support Services.

Let’s take a look at how our Support Team is ready to help customers with SQL Server Error 35250.

How to resolve SQL Server Error 35250?

Usually, this error occurs whenever there is a communication issue between endpoints of both replicas or any replica unable to connect to the endpoints.

The error message is given below:

Failed to Join the database ‘DBName’ to the availability group ‘AOAG-Name’ on the availability replica ‘Availability Replica Name’

If we use T-SQL, the error message shown as given below:

Msg 35250, Level 16, State 7, Line 1
The connection to the primary replica is not active. The command cannot be processed. (microsoft sql server, error: 35250)

Today, let us see the steps followed by our Support Techs to resolve it.

By default, AlwaysOn configures the database mirroring endpoints to use port 5022.

However, we can use any other configure port for the database mirroring endpoints in your environment.

Query sys.tcp_endpoints on each replica to confirm which port is being use:

select name, type, port from sys.tcp_endpoints where type_desc=’database_mirroring’
go

By default inbound traffic is block in Windows firewall.

Port 5022 is use by the primary and secondary replicas for synchronization and communication purposes.

Traffic must allow inbound on this port.

  • Endpoint is not created or started

Firstly, ensure the mirroring endpoints are create and start on the primary and the secondary replicas.

To detect if the endpoints are create, query for database_mirroring endpoints at the primary and the secondary.

:Connect SQLNODE1
select name, state_desc, port from sys.tcp_endpoints where type_desc=’DATABASE_MIRRORING’
go
:Connect SQLNODE2
select name, state_desc, port from sys.tcp_endpoints where type_desc=’DATABASE_MIRRORING’
go

If we find an endpoint does not exist, create it:

:Connect SQLNODE1
create endpoint [Hadr_endpoint]
state=started
as tcp (listener_port = 5022, listener_ip = all)
for database_mirroring (role = all, authentication = windows negotiate, encryption = required algorithm aes)
go

Then, to detect if the endpoints are start, query them at the primary and the secondary.

:Connect SQLNODE1
select name, state_desc, port FROM sys.tcp_endpoints where name=’hadr_endpoint’
go
:Connect SQLNODE2
select name, state_desc, port from sys.tcp_endpoints where name=’hadr_endpoint’
go

If we find an endpoint is not running, start it:

:Connect SQLNODE1
alter endpoint [Hadr_endpoint] state = started
  • Endpoint permissions

If database mirroring endpoints are configure to use Windows authentication, ensure that the SQL Server instances hosting our availability replicas run with a SQL Server startup account are domain accounts.

The New Availability Group wizard catches this misconfiguration, and reports it.

Then if we proceed by clicking Yes and complete the wizard, it will fail during the ‘Joining to availability group at .’

If we are attempting to create an availability group using transact-sql, this configuration problem will not detect and command ALTER DATABASE…SET HADR AVAILABILITY GROUP… will fail with 35250.

  • SQL Server is not listening on port 5022

If SQL Server is unable to listen on port 5022, the New Availability Group wizard and the transact-sql command ALTER DATABASE…SET HADR AVAILABILITY GROUP… will fail with 35250.

To determine if SQL Server is listening on port 5022, review the SQL Server error log. We should find the following message(s) in the SQL Server error log:

2022-03-03 08:52:25.47 spid23s Server is listening on [ ‘any’ 5022].
2022-03-03 08:52:25.47 spid23s Server is listening on [ ‘any’ 5022].

SQL Server may not able to listen on port 5022 if another application is already listening on the port.

If we find that SQL Server is not listening on port 5022 because it is already use, run netstat -a to determine what application is using the port.

  • SQL Server service accounts not added to SQL Server Instances

There should Grant CONNECT permission on Always On endpoint.

We can obtain the endpoints list using the command:

select * from sys.endpoints;

We can grant connect permission on endpoint using the command given below:

GRANT CONNECT on ENDPOINT::Endpoint_Name TO [login_name];

where Endpoint_Name is the name of the endpoint and the login_name is the service account that is used to run SQL Server services.

As the account does not exist on secondary replica, it will result in the error:

Msg 15151, Level 16, State 1, line 1
Cannot find the login ‘login_name’, because it does not exist or you do not have permission.

We have to create this service account on secondary replica as well or where it was missing on any of the replica.

After that, re-add the database to the AOAG configuration.

[Looking for a solution to another query? We are just a click away.]

Conclusion

To sum up, our skilled Support Engineers at Bobcares demonstrate how to resolve SQL Server Error 35250.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF