The connection to the primary replica is not active. The command cannot be processed. (Microsoft SQL Server, Error: 35250)

  • I am getting this error  while adding replica in Always on SQL Server 2014 enterprise edition

    The connection to the primary replica is not active.  The command cannot be processed. (Microsoft SQL Server, Error: 35250)

    I attached screen shot. Any one can check this end point screen shot. please tell how to fix this.

  • Hi

    I noticed on your screenshot that mirroring endpoint of your primary repica is 445. It should be 5022.

    1. Ensure the mirroring endpoints are created and started on the primary and the secondary replicas.

    :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 you 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

    -- To detect if the endpoints are started, 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 you find an endpoint is not running, start it:

     :Connect SQLNODE1
    alter endpoint [Hadr_endpoint] state = started

    2. Ensure that SQL Server is listening to 5022 

    The error is due to the service account is not able to connect to SQL Server on database mirroring / AlwaysOn AG port. To resolve, issue the command below.

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

    2013-12-09 08:52:25.47 spid23s     Server is listening on [ ‘any’ <ipv6> 5022].
    2013-12-09 08:52:25.47 spid23s     Server is listening on [ ‘any’ <ipv4> 5022]. 

    SQL Server may not be able to listen on port 5022 if another application is already listening on the port. If you find that SQL Server is not listening on port 5022 because it is already being used, run ‘netstat -a’ to determine what application is using the port:

    3. Ensure that the service account is able to connect to SQL Server on database mirroring / AlwaysOn AG port. If not, execute the command below. 

    GRANT CONNECT ON ENDPOINT::Hadr_endpoint TO [DomainName\svc_sql]

    This should solve the problem.

    Best Regards

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply