PROCEDURE:
The following are the steps that I did to configure the mirror:
1.- On PRINCIPAL.domain.com, I did a full backup for each database that we need to mirror on the other server. (Previusly, I checked that recovery method for each database are configured to FULL)
2.- Then, on MIRROR.domain.com, I restored all the backups with NORECOVERY option selected. Until now, all it’s ok. Databases are showed with «Restoring…» status.
3.- When I finished to restore all the databases, I try to configure mirror on PRINCIPAL.domain.com
4.- I select a database, I ran «Configure Security…» wizard. I select the options, the endpoint configuration finished without errors or warnings; On this moment appears the option to START MIRRORING. I selected and appear this error message:
TITLE: Database Properties
——————————
An error occurred while starting mirroring.
——————————
ADDITIONAL INFORMATION:
Alter failed for Database ‘SharePoint_AdminContent_0376bde9-ea3e-4609-be1a-401236010f8d’. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Alter+Database&LinkId=20476
——————————
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
The server network address «TCP://NABONIDUS.infrasoftcorp.com:5022» can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. (Microsoft SQL Server, Error: 1418)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=1418&LinkId=20476
——————————
BUTTONS:
OK
——————————
5.- So, on MIRROR.domain.com, now the database appears with «In Recovery…», but the mirror is not function.
End of the procedure.
SOME IMPORTANT ISSUES:
A.- When I ran the «Configure Security…» wizard, the Summary page shows the settings that I selected and that you can see below. (You can see that PRIMARY is configured to use encryption, but MIRROR don’t. By the way, I’m unabled to change this setting, when PRINCIPAL page appears, the Encription option is grayed and checked). I don’t know if this is the root cause of the problem:
———————————
Click Finish to perform the following actions:
On the principal server instance, PRIMARY.domain.com
Modify the following properties of the mirroring endpoint:
Name: Mirroring
Listener Port: 5022
Encryption: Yes
Role: Partner
On the mirror server instance, MIRROR.domain.com
Modify the following properties of the mirroring endpoint:
Name: Mirroring
Listener Port: 5022
Encryption: No
Role: Partner
———————————
B.- I checked firewall on servers. On both, the Windows Firewall is disabled.
C.- I can ping PRIMARY from MIRROR, and viceversa.
D.- I can TELNET on 5022 TCP port (both servers)
I will appreciate all help that you can provide me. I have very little experience working with SQL.
I am trying to mirroring a database in sql server. I created a database and took a backup of it and restored on the another server. But after doing all operations and click on start mirroring, then it showing following error. I put «NO» to Witness server option
.
I followed mirroring steps in this link Here it says, create an user on both principal and mirror server with the same credentials in STEP 3. Is it necessary to create same user on both servers? or any alternate solution is there?
Mihir
8,61818 gold badges56 silver badges85 bronze badges
asked Jun 14, 2012 at 12:19
1
I also faced same problem. you need to check the following items once.
-
Goto services.msc and check the sql server is running under which account. Make sure that sql server and sql server agent services should run with same credentials.
-
in the mirror database server you should do the same step as step 1. Give the same credentials as in principal server. If that user is not present create a new one on the both servers with same credentials.
-
Now got principal server and in sql server add the new login under Security—>Login. Give the server roles as Sysadmin and public. Add the same user on the mirror server also.
-
Now do the mirror in the principal database. You did not get any error there.
answered Jun 15, 2012 at 11:14
MihirMihir
8,61818 gold badges56 silver badges85 bronze badges
3
Same problem , error 1418. Did everything suggested here: link
In hindsight it was obvious. When completing the MIRRORING > CONFIGURE SECURITY WIZARD you get a page explaining the results. Looking at SQL1 and SQL2 nodes this line was the key:
On the principal server instance, SQL1
Listener Port: 5022
Encryption: **Yes**
On the mirror server instance, SQL2
Listener Port: 5022
Encryption: **No**
Solution. After finishing the wizard on all SQL nodes execute:
drop endpoint Mirroring
go
CREATE ENDPOINT Mirroring
STATE = STARTED
AS TCP ( LISTENER_PORT = 5022 )
FOR DATABASE_MIRRORING
(ENCRYPTION = DISABLED,ROLE=ALL)
GO
Hit start mirroring, problem solved.
Hope that helps someone
Scott
answered Oct 24, 2013 at 9:55
scott_lotusscott_lotus
3,13521 gold badges49 silver badges69 bronze badges
After exhausting all the options as mentioned above, I had a variation to the mirroring environment. We had a SQL server 2008 contributing to 2014 Server in Principal-Mirror configuration. The 2014 Sql server was also being used in AlwaysOn config for HA of some other Db’s. The end points are now named differently on sql 2008 and sql 2014.
After getting the above mentioned error, I found that the Encryption for 2008 is RC4 and that for 2014 is AES. As a result, it was failing handshake with the SQL2014 endpoint. I changed the encryption to match that of the SQL 2008 using the below command and viola!!
ALTER ENDPOINT [Hadr_endpoint]
FOR DATA_MIRRORING ( ENCRYPTION = REQUIRED ALGORITHM RC4 )
answered Nov 9, 2015 at 19:53
You also may not be leaving the copy intended for mirroring in a restore state, which it must be left in to turn on mirroring.
Typically, the procedure for SQL Server mirroring is:
1) Backup the original database and copy it to the server intended for mirroring.
2) Backup the transaction log and copy it to the server intended for mirroring.
3) Chose restore database from the MMC and locate the backup of the database and restore it with options set to leave in non-functioning state with no rollback of transactions.
4) Chose restore and chose files and then select log files and restore the log file backup also with the option of no rolloback and non-functioning. It is the second radio button down under the options page on sql server 2008.
5) go to the original database copy server and turn on mirroring. You will need to use an account that has sysadmin rights on both servers for the mirroring conversations to start up.
answered Feb 8, 2013 at 16:22
![]()
I met this issue before, all the validation pass.
Use a new endpoint at last, it works.
The root cause is 5022 may block other session.
answered Apr 15, 2014 at 7:01
For me, I had this issue crop up and resolved it ultimately by dropping and recreating the mirroring endpoints (SSMS -> Server Objects -> Endpoints -> Database Mirroring)
answered Nov 10, 2015 at 17:37
![]()
Mark SowulMark Sowul
10.1k1 gold badge44 silver badges51 bronze badges
My error 1418 was resolved by using the same drives letter on both servers…
Although MS suggests that you can use different letters, I decided to use the same drives letter…
From MS:
Also, we recommend that, if it is possible, the file path (including
the drive letter) of the mirror database be identical to the path of
the principal database. If the file paths must differ, for example, if
the principal database is on drive ‘F:’ but the mirror system lacks an
F: drive, you must include the MOVE option in the RESTORE statement.
![]()
KlajdPaja
9591 gold badge8 silver badges17 bronze badges
answered Jun 25, 2015 at 16:37
In case none of the above worked, here is what caused my problem.
Run the following query on both servers and look closely
SELECT @@Version
I had some updates on my principal server that were not installed on my mirror server.
Also, you can see additional info in SQL Server Log to reasons why the mirroring doesn’t work. That’s how I realized I had a different version on both servers.
answered Oct 20, 2016 at 17:49
![]()
On SQL Server 2016, the solution is to have your [domain account] as sysadmin on both principal and mirror server. Then create a new account as of the following
Principal server
use [master]
GO
CREATE LOGIN [domainmirrorservername$] FROM WINDOWS
GO
GRANT CONNECT ON ENDPOINT::[Mirroring] TO [domainmirrorservername$]
GO
Mirror Server
use [master]
GO
CREATE LOGIN [domainprincipalservername$] FROM WINDOWS
GO
GRANT CONNECT ON ENDPOINT::[Mirroring] TO [domainprincipalservername$]
GO
You need to create those account and grant CONNECT permission as those accounts are the ones used during the handshake between principal and mirror server.
For more details on the error, check your sql error logs.
Hope this post helps someone.
![]()
Fejs
2,7062 gold badges20 silver badges39 bronze badges
answered Sep 14, 2017 at 5:29
I had the same issue. I was trying to setup mirroring on Windows 2008 — R2, on a Domain setup. As suggested above by one of the experts, I checked the SQL Server ‘logon’ accounts for the SQLSERVER and SQLSERVERAGENT and used the same Domain account for the the SQL Server services on both machines. I was able to setup the mirroring.
Thanks for the help!
answered Dec 13, 2017 at 16:57

SQL Server comes with several inbuilt features for proper maintenance or availability of the database that supports failover clustering. One of them is SQL Server Database Mirroring, which is a disaster recovery and high availability technique that works only with databases using a full recovery model.
Though mirroring helps in increasing availability and data protection, the users encounter a common error while using the Mirroring feature, known as SQL Server Database Mirroring Error 1418. The blog discusses what is Microsoft SQL Server error 1418 Mirroring and how to resolve it.
SQL Server Database Mirroring Error 1418
The SQL Server Database Mirroring is a feature that involves two SQL Server instances where a copy of a single database is created on the same or different machines. One SQL Server instance that acts as a primary instance is called principal and other one is a mirrored instance called the mirror. One of the common Microsoft SQL Server error 1418 associated with mirroring that displays the following error message:
“The server network address cannot be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational.”
This error happens when the server network endpoint did not respond because the specified server network cannot be reached or it does not exist.
How to Troubleshoot Microsoft SQL Server Error 1418?
SQL Server Database Mirroring Error 1418 occurs due to connection problem between endpoints, the first thing we need to do is to check TCP/IP for the instance if it has been enabled or not.
Steps that need to be followed are:
- Check if the system Firewall has not block SQL Server port.
- Go to Computer Management → Service and Application → SQL Server 2005 Configuration → Network Configuration.
- See if the TCP/IP protocol is enabled or not in Network Configuration and make sure that SQL SERVER port is by Default 1433.
- Now check if TCP/IP protocol is enabled or not in Client Configuration Tab under Computer Management → Service and Application → SQL Server 2005 Configuration.
If the error cannot be resolved still, follow the below steps:
Manual Solutions Available for Users
- Service Accounts Verification
- CONNECT permissions to partner’s endpoints is required by SQL Server Service account
- It is recommended that we use domain accounts for all partners.
- For Local service, certificate authentication should be used.
- For Network service, computer account should be used.
- See the SQL log for errors.
- Ports Verification
While configuring network for a database mirroring session, database-mirroring endpoint of each server instance should be used only by database mirroring process. If another process is listening on the port assigned to database mirroring endpoint, the database mirroring processes of the other server instances cannot connect to the endpoint.- Use the netstat command to display all the ports on which Windows-based server is listening.
- Use Telnet to test if the port is open and something is listening.
- Ensure no other SQL instances are connected on the server.
- Check if Firewall is allowing traffic both directions & not blocking the port
- Ensure all instances can access every other partner
- Ping each partner from one another.
- To trace the path of the IP, use tracert to each partner
- Double check the ports if ping or tracert fails
- Verify Endpoints
- Ensure that all endpoints are started.
- Make sure all endpoints are using same encryption algorithm.
- Ensure that OS supports chosen encryption algorithm on all partners.
Automated Solution if the Issue Arises Due to Database File Corruption
In case, the above-mentioned manual solutions do not work, then the problem is in the database. Evidently, the corruption in SQL databases is a well-known issue & this can also cause the mirroring SQL server error 1418. Simply download the repair & recovery tool that IT experts suggests to get rid of the corruption issues.
Download Now Purchase Now
After downloading the tool, follow these five simple steps to get a detailed solution.
Step-1. Launch the Tool and Navigate to the Open button to start fixing error 1418.

Step-2. Select Quick or Advance Scan to detect corruption.

Step-3. Preview the Database Objects and proceed further.

Step-4. Choose the Export settings accordingly as you prefer.

Step-5. Finally, Click on Export to fix the SQL error 1418.

Conclusion
The primary aim of this blog is to study the common error encountered by SQL database users while performing mirroring operations. Evidently, we hope now users can easily solve their Microsoft SQL Server Error 1418. This error restricts the server network endpoint from responding as the specified server network cannot be reached or it does not exist. It further suggests a solution for users to overcome SQL Server Database Mirroring Error 1418 using the steps defined in the blog.
Are you stuck with SQL Server Mirroring Error 1418? We’ll help you fix this Mirroring Error.
The Database mirroring helps in creating redundant copies of a database and increasing the availability of a SQL Server database.
Here at Bobcares, we often receive requests to fix the Mirroring Error 1418 as a part of our Server Management Services.
Today, let’s see how our Support Engineers fix the mirroring error 1418 for our customers.
What is SQL Server Mirroring 1418 Error?
The SQL Server Database Mirroring includes two SQL Server instances.
One instance acts as a primary instance and it is Principal instance. And the other one is a mirror instance.
The SQL Server Mirroring 1418 error occurs when the server network endpoint is not responding. Usually, it doesn’t respond because the specified server network cannot reach or it does not exist.

How to fix SQL Server Mirroring Error 1418?
Recently one of our customers contacted us with the error. Let’s discuss how our Support Engineers resolve the error for our customers.
The Mirroring Error 1418 mainly occurs due to the connection problems between the endpoints. We follow the below steps to fix the SQL Server Mirroring Error 1418.
1. We make sure that the system Firewall is not blocking the SQL Server port.
2.Then we go to Computer Management > Service and Application > SQL Server 2005 Configuration > Network Configuration > Enable TCP/IP protocol.
Also, we make sure that SQL SERVER port is 1433.
3. Then we check that the TCP/IP protocol is enabled or not. We go to Computer Management > Service and Application > SQL Server 2005 Configuration > Client Configuration > Enable TCP/IP protocol.
If the error doesn’t resolve by the above method, then we try the below methods also.
1. Service Accounts Verification
Sometimes the Mirroring 1418 error occurs due to the incorrect service account.
Firstly we Connect permissions to partner’s endpoints which are required by the SQL Server Service account.
We use domain accounts for all partners.
For the Local service, the certificate authentication is used and in the Network service, the computer account should be used.
2. Ports Verification
The database mirroring endpoint of each server instance is used only by the database mirroring process.
If any other processes are listening to the port assign to database mirroring endpoint then the other server instances cannot connect to the endpoint.
So we check that the Firewall is not blocking the port and allowing the traffic on both directions.
3. Verify Endpoints
We make sure that all endpoints are started.
All the endpoints must use the same encryption algorithm. We make sure that they are all using the same.
Also, we ensure that all the instances can access every other partner by Ping each partner from one another.
[Need assistance in SQL Server Mirroring Error 1418? – We can help you.]
Conclusion
In short, the Mirroring Error 1418 happens when the server network endpoints don’t respond. Also, we’ve discussed how our Support Engineers fix the error for our customers.
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
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
We got error 1418 while configuring Database Mirroring on one of the SQL Server database instance. The error details are given below:
The server network address “TCP://ServerName.abc.local:5022″ cannot be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. (Microsoft SQL Server, Error: 1418)
Reason behind Error 1418
Main reason behind database mirroring error 1418 is because the specified server network address cannot be reached or does not exist. The server network address cannot be reached because of multiple reasons. Some of them are given below.

- Principal, Mirror and Witness servers are not talking to each other.
- Wrong network address name, mirror server instance name or port number.
- Mirror database is not ready for mirroring.
- Principal or mirror server instance is behind a firewall.
- You are using local system account to run SQL Server services and not using certificates for authentication.
- SQL Server services are running with different domain accounts on Principal and Mirror server and service accounts don’t have enough permission on endpoints.
- Different endpoint encryption value set on Principal, Mirror and Witness server.
- Endpoints are not started on the partner servers.
- Principal server instance is not listening on the port assigned to its database mirroring endpoint.
We need to verify each option mentioned above carefully to fix this error.
Solution
The solution of this issue may vary case to case depending on the nature of issue. To fix this issue we need to find out the main root cause behind error 1418. The root cause may be anything that is given in above section. Here I will describe each probable reason given above and its solution to fix this issue. Make sure to go through with each point given in this article.
Principal, Mirror and Witness Servers Should be Accessible
Make sure that SQL Server Instances installed on Principal, Mirror & Witness servers are accessible to each other. If remote login for any SQL Server instance is not enabled then you might get this issue. You can enable remote connectivity by enabling TCP/IP and Named Pipes protocols in SQL Server Configuration Manager. Each system must access the ports of the other SQL Server instances over TCP. You can try telnet the SQL Server ports of other partners.
Verify Correct System Details
Sometimes we entered wrong details that end up with throwing errors. Make sure to verify the network address name, mirror server instance name and its port numbers are correct. You can recheck all the details whether you have entered them correctly or not.
Mirror Database Preparation
Verify that the mirror database is ready for database mirroring. We should prepare mirror database before configuring or during configuring database mirroring. It is suggested to keep identical drive path for mirror database files. Below are the steps you should take care for preparing your mirroring database.
- Run full backup and subsequent transactional log backup of the Principal database and copy it to the Mirror server.
- Restore database with same name in norecovery state on Mirror server with the copied backup files from above step. You must ensure that restored database on mirror server should be in restoring mode before starting database mirroring configuration.
Firewall/Ports
One of the probable reason to get error 1418 is partner servers are behind firewall. Make sure that the principal server instance and destination mirror server instance is not behind a firewall and they should talk to each other. Principal server, Mirror server and witness server should be accessible to each other.
Verify that SQL Server port and endpoint ports are enabled and accessible via telnet. If not or you are not able to telnet any of the partner instance from any server participating in mirroring then you should ask your network admins to open these ports to establish the connectivity over given port.
Endpoints
Make sure that endpoint has been created on principal, mirror and witness servers. Verify that the endpoints are started on each partner server instances. You can check endpoint status by running below T-SQL query on each instance.
SELECT state_desc FROM sys.database_mirroring_endpoints
If either endpoint is not started, execute below ALTER ENDPOINT statement to start it.
#Change the name of your endpoints. Here endpoint name is Mirroring ALTER ENDPOINT Mirroring STATE = STARTED AS TCP (LISTENER_PORT = <port_number>) FOR database_mirroring (ROLE = ALL); GO
Recheck that the principal server instance is listening on the port assigned to its database mirroring endpoint and the mirror server instance is listening on its port. If a partner is not listening on its assigned port, modify the database mirroring endpoint to listen on a different port.
Sometimes this issue got fixed by dropping the existing endpoint and recreate it again on partner servers.
Service Accounts
Do not use local system account to run SQL Server services. If you don’t have any choice and want to use local system then ensure to use certificates for authentications.
Make sure that service accounts that you are using to run SQL Server services must have CONNECT permission to mirroring endpoints. Also, if you are configuring database mirroring between two domains then the login of one account must be created in master database on the other computer, and that login must be granted CONNECT permissions on the endpoint.
It’s always advisable to use same service accounts to run SQL Server services on all three Instances on Principal, Mirror and Witness server.
You can comment us your experience about fixing this issue. We will update this article with your solution that you have used to fix this issue.
I hope you like this article. Please follow us on our Facebook page and Twitter handle to get latest updates.
Read More:
- Fix Error 15141: The server principal owns one or more endpoints and cannot be dropped
- Fix AOAG Error 35250: Joining database on Secondary Replica resulted in an error
- How to Upgrade or Patch Availability Group Instances?
- SQL Server Always On Interview Questions and Answers
- Author
- Recent Posts
![]()
I am working as a Technical Architect in one of the top IT consulting firm. I have expertise on all versions of SQL Server since SQL Server 2000. I have lead multiple SQL Server projects like consolidation, upgrades, migrations, HA & DR. I love to share my knowledge. You can contact me on my social accounts for any consulting work.
![]()
Summary
Article Name
Fix Error 1418: The server network address cannot be reached or does not exist.
Description
We got error 1418 while configuring Database Mirroring on one of the SQL Server database instance. The error details are given below: The server network address “TCP://ServerName.abc.local:5022″ cannot be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. (Microsoft SQL Server, Error: 1418)
PROCEDURE:
The following are the steps that I did to configure the mirror:
1.- On PRINCIPAL.domain.com, I did a full backup for each database that we need to mirror on the other server. (Previusly, I checked that recovery method for each database are configured to FULL)
2.- Then, on MIRROR.domain.com, I restored all the backups with NORECOVERY option selected. Until now, all it’s ok. Databases are showed with «Restoring…» status.
3.- When I finished to restore all the databases, I try to configure mirror on PRINCIPAL.domain.com
4.- I select a database, I ran «Configure Security…» wizard. I select the options, the endpoint configuration finished without errors or warnings; On this moment appears the option to START MIRRORING. I selected and appear this error message:
TITLE: Database Properties
——————————
An error occurred while starting mirroring.
——————————
ADDITIONAL INFORMATION:
Alter failed for Database ‘SharePoint_AdminContent_0376bde9-ea3e-4609-be1a-401236010f8d’. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Alter+Database&LinkId=20476
——————————
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
The server network address «TCP://NABONIDUS.infrasoftcorp.com:5022» can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. (Microsoft SQL Server, Error: 1418)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=1418&LinkId=20476
——————————
BUTTONS:
OK
——————————
5.- So, on MIRROR.domain.com, now the database appears with «In Recovery…», but the mirror is not function.
End of the procedure.
SOME IMPORTANT ISSUES:
A.- When I ran the «Configure Security…» wizard, the Summary page shows the settings that I selected and that you can see below. (You can see that PRIMARY is configured to use encryption, but MIRROR don’t. By the way, I’m unabled to change this setting, when PRINCIPAL page appears, the Encription option is grayed and checked). I don’t know if this is the root cause of the problem:
———————————
Click Finish to perform the following actions:
On the principal server instance, PRIMARY.domain.com
Modify the following properties of the mirroring endpoint:
Name: Mirroring
Listener Port: 5022
Encryption: Yes
Role: Partner
On the mirror server instance, MIRROR.domain.com
Modify the following properties of the mirroring endpoint:
Name: Mirroring
Listener Port: 5022
Encryption: No
Role: Partner
———————————
B.- I checked firewall on servers. On both, the Windows Firewall is disabled.
C.- I can ping PRIMARY from MIRROR, and viceversa.
D.- I can TELNET on 5022 TCP port (both servers)
I will appreciate all help that you can provide me. I have very little experience working with SQL.
PROCEDURE:
The following are the steps that I did to configure the mirror:
1.- On PRINCIPAL.domain.com, I did a full backup for each database that we need to mirror on the other server. (Previusly, I checked that recovery method for each database are configured to FULL)
2.- Then, on MIRROR.domain.com, I restored all the backups with NORECOVERY option selected. Until now, all it’s ok. Databases are showed with «Restoring…» status.
3.- When I finished to restore all the databases, I try to configure mirror on PRINCIPAL.domain.com
4.- I select a database, I ran «Configure Security…» wizard. I select the options, the endpoint configuration finished without errors or warnings; On this moment appears the option to START MIRRORING. I selected and appear this error message:
TITLE: Database Properties
——————————
An error occurred while starting mirroring.
——————————
ADDITIONAL INFORMATION:
Alter failed for Database ‘SharePoint_AdminContent_0376bde9-ea3e-4609-be1a-401236010f8d’. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Alter+Database&LinkId=20476
——————————
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
The server network address «TCP://NABONIDUS.infrasoftcorp.com:5022» can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. (Microsoft SQL Server, Error: 1418)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=1418&LinkId=20476
——————————
BUTTONS:
OK
——————————
5.- So, on MIRROR.domain.com, now the database appears with «In Recovery…», but the mirror is not function.
End of the procedure.
SOME IMPORTANT ISSUES:
A.- When I ran the «Configure Security…» wizard, the Summary page shows the settings that I selected and that you can see below. (You can see that PRIMARY is configured to use encryption, but MIRROR don’t. By the way, I’m unabled to change this setting, when PRINCIPAL page appears, the Encription option is grayed and checked). I don’t know if this is the root cause of the problem:
———————————
Click Finish to perform the following actions:
On the principal server instance, PRIMARY.domain.com
Modify the following properties of the mirroring endpoint:
Name: Mirroring
Listener Port: 5022
Encryption: Yes
Role: Partner
On the mirror server instance, MIRROR.domain.com
Modify the following properties of the mirroring endpoint:
Name: Mirroring
Listener Port: 5022
Encryption: No
Role: Partner
———————————
B.- I checked firewall on servers. On both, the Windows Firewall is disabled.
C.- I can ping PRIMARY from MIRROR, and viceversa.
D.- I can TELNET on 5022 TCP port (both servers)
I will appreciate all help that you can provide me. I have very little experience working with SQL.
| title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | ms.custom | helpviewer_keywords | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Troubleshoot Always On Availability Groups Configuration (SQL Server) |
Troubleshoot typical problems with configuring server instances for Always On availability groups in SQL Server. |
MashaMSFT |
mathoma |
05/17/2016 |
sql |
availability-groups |
troubleshooting |
seo-lt-2019 |
|
Troubleshoot Always On Availability Groups Configuration (SQL Server)
[!INCLUDE SQL Server]
This topic provides information to help you troubleshoot typical problems with configuring server instances for [!INCLUDEssHADR]. Typical configuration problems include [!INCLUDEssHADR] is disabled, accounts are incorrectly configured, the database mirroring endpoint doesn’t exist, the endpoint is inaccessible (SQL Server Error 1418), network access doesn’t exist, and a join database command fails (SQL Server Error 35250).
[!NOTE]
Ensure that you are meeting the [!INCLUDEssHADR] prerequisites. For more information, see Prerequisites, Restrictions, and Recommendations for Always On Availability Groups (SQL Server).
In This Topic:
| Section | Description |
|---|---|
| Always On Availability Groups Isn’t Enabled | If an instance of [!INCLUDEssNoVersion] is not enabled for [!INCLUDEssHADR], the instance doesn’t support availability group creation and can’t host any availability replicas. |
| Accounts | Discusses requirements for correctly configuring the accounts under which [!INCLUDEssNoVersion] is running. |
| Endpoints | Discusses how to diagnose issues with the database mirroring endpoint of a server instance. |
| Network access | Documents the requirement that each server instance that is hosting an availability replica must be able to access the port of each of the other server instances over TCP. |
| Listener | Documents how to establish the IP address and port of the listener and make sure it is running and listening for incoming connections |
| Endpoint Access (SQL Server Error 1418) | Contains information about this [!INCLUDEssNoVersion] error message. |
| Join Database Fails (SQL Server Error 35250) | Discusses the possible causes and resolution of a failure to join secondary databases to an availability group because the connection to the primary replica isn’t active. |
| Read-Only Routing is Not Working Correctly | |
| Related Tasks | Contains a list of task-oriented topics in [!INCLUDEssnoversion] Books Online that are relevant to troubleshooting an availability group configuration. |
| Related Content | Contains a list of relevant resources that are external to [!INCLUDEssNoVersion] Books Online. |
Always On Availability Groups Is Not Enabled
The [!INCLUDEssHADR] feature must be enabled on each of the instances of [!INCLUDEssnoversion].
If the Always On Availability Groups feature isn’t enabled, you’ll get this error message when you try to create an Availability group on SQL Server.
The Always On Availability Groups feature must be enabled for server instance 'SQL1VM' before you can create an availability group on this instance. To enable this feature, open the SQL Server Configuration Manager, select SQL Server Services, right-click on the SQL Server service name, select Properties, and use the Always On Availability Groups tab of the Server Properties dialog. Enabling Always On Availability Groups may require that the server instance is hosted by a Windows Server Failover Cluster (WSFC) node. (Microsoft.SqlServer.Management.HadrTasks)
The error message clearly indicates that the AG feature isn’t enabled and also directs you how to enable it. There are two scenarios where you can get in this state besides the obvious one where AG wasn’t enabled in the first place.
- If SQL Server was installed and the Always On Availability Groups feature was enabled before you installed the Windows Failover Clustering feature, you may get this error when you attempt to create an Always On AG.
- If you remove an existing Windows Failover Clustering feature and rebuild it while SQL Server still has Always On configured, when you attempt to use AG again this error may occur.
In such cases you can take the following steps to resolve it:
- Disable the AG feature
- Restart SQL Server service
- Enable the AG feature back
- Again restart the SQL Service
For more information, see Enable and Disable Always On Availability Groups (SQL Server).
Accounts
The accounts under which [!INCLUDEssNoVersion] is running must be correctly configured.
-
Do the accounts have the correct permissions?
-
If the partners run under the same domain account, the correct user logins exist automatically in both master databases. This simplifies the security configuration and is recommended.
-
If two server instances run under different accounts, then each account must be created in master on the remote server instance, and that server principal must be granted CONNECT permissions to connect to the database mirroring endpoint of that server instance. For more information, see Set Up Login Accounts for Database Mirroring or Always On Availability Groups (SQL Server). You can use the following query on each instance to check if the logins have CONNECT permissions:
SELECT perm.class_desc, prin.name, perm.permission_name, perm.state_desc, prin.type_desc as PrincipalType, prin.is_disabled FROM sys.server_permissions perm LEFT JOIN sys.server_principals prin ON perm.grantee_principal_id = prin.principal_id LEFT JOIN sys.tcp_endpoints tep ON perm.major_id = tep.endpoint_id WHERE perm.class_desc = 'ENDPOINT' AND perm.permission_name = 'CONNECT' AND tep.type = 4
-
-
If [!INCLUDEssNoVersion] is running under a built-in account, such as Local System, Local Service, or Network Service, or a nondomain account, you must use certificates for endpoint authentication. If your service accounts are using domain accounts in the same domain, you can choose to grant CONNECT access for each service account on all the replica locations or you can use certificates. For more information, seeUse Certificates for a Database Mirroring Endpoint (Transact-SQL).
Endpoints
Endpoints must be correctly configured.
-
Make sure that each instance of [!INCLUDEssNoVersion] that is going to host an availability replica (each replica location) has a database mirroring endpoint. To determine whether a database mirroring endpoint exists on a given server instance, use the sys.database_mirroring_endpoints catalog view:
SELECT name, state_desc FROM sys.database_mirroring_endpoints
For more information on creating endpoints, see either Create a Database Mirroring Endpoint for Windows Authentication (Transact-SQL) or Allow a Database Mirroring Endpoint to Use Certificates for Outbound Connections (Transact-SQL).
-
Check that the port numbers are correct.
To identify the port currently associated with database mirroring endpoint of a server instance, use the following [!INCLUDEtsql] statement:
SELECT type_desc, port FROM sys.tcp_endpoints; GO
-
For [!INCLUDEssHADR] setup issues that are difficult to explain, we recommend that you inspect each server instance to determine whether it’s listening on the correct ports.
-
Make sure that the endpoints are started (STATE=STARTED). On each server instance, use the following [!INCLUDEtsql] statement:
SELECT state_desc FROM sys.database_mirroring_endpointsFor more information about the state_desc column, see sys.database_mirroring_endpoints (Transact-SQL).
To start an endpoint, use the following [!INCLUDEtsql] statement:
ALTER ENDPOINT Endpoint_Mirroring STATE = STARTED AS TCP (LISTENER_PORT = <port_number>) FOR database_mirroring (ROLE = ALL); GOFor more information, see ALTER ENDPOINT (Transact-SQL).
[!NOTE]
In some cases, if the endpoint is started but the AG replicas are not communicating, you may try to stop and restart the endpoint. You can use ALTER ENDPOINT [Endpoint_Mirroring] STATE = STOPPED followed by ALTER ENDPOINT [Endpoint_Mirroring] STATE = STARTED -
Make sure that the login from the other server has CONNECT permission. To determine who has CONNECT permission for an endpoint, on each server instance use the following [!INCLUDEtsql] statement:
SELECT 'Metadata Check'; SELECT EP.name, SP.STATE, CONVERT(nvarchar(38), suser_name(SP.grantor_principal_id)) AS GRANTOR, SP.TYPE AS PERMISSION, CONVERT(nvarchar(46),suser_name(SP.grantee_principal_id)) AS GRANTEE FROM sys.server_permissions SP , sys.endpoints EP WHERE SP.major_id = EP.endpoint_id ORDER BY Permission,grantor, grantee;
-
Ensure correct server name is used in the endpoint URL
For server name in an endpoint URL, it’s recommended to use fully qualified domain name (FQDN), although you can use any name that uniquely identifies the machine. The server address can be a Netbios name (if the systems are in the same domain), a fully qualified domain name (FQDN), or an IP address (preferably, a static IP address). Using the fully qualified domain name is the recommended option.
If you’ve already defined an Endpoint URL, you can query it by using:
select endpoint_url from sys.availability_replicas
Next, compare the endpoint_url output to the server name (NetBIOS name or FQDN).
To query the server name, run the following commands in a PowerShell on the replica locally:$env:COMPUTERNAME [System.Net.Dns]::GetHostEntry([string]$env:computername).HostName
To validate the server name on a remote computer, run this command from PowerShell.
$servername_from_endpoint_url = "server_from_endpoint_url_output" Test-NetConnection -ComputerName $servername_from_endpoint_url
For more information, see Specify the Endpoint URL When Adding or Modifying an Availability Replica (SQL Server).
[!NOTE]
To use Kerberos authentication for the communication between availability group (AG) endpoints, register a Service Principal Name for Kerberos Connections for the database mirroring endpoints used by the AG.
Network Access
Each server instance that is hosting an availability replica must be able to access the port of each of the other server instance over TCP. This is especially important if the server instances are in different domains that don’t trust each other (untrusted domains). Check if you can connect to the endpoints by following these steps:
-
Use Test-NetConnection (equivalent to Telnet) to validate connectivity. Here are examples of commands you can use:
$server_name = "your_server_name" $IP_address = "your_ip_address" $port_number = "your_port_number" Test-NetConnection -ComputerName $server_name -Port $port_number Test-NetConnection -ComputerName $IP_address -Port $port_number
-
If the Endpoint is listening and connection is successful, you will see «TcpTestSucceeded : True». If not, you’ll receive a «TcpTestSucceeded : False».
-
If Test-NetConnection (Telnet) connection to the IP address works but to the ServerName it doesn’t, there’s likely a DNS or name resolution issue
-
If connection works by ServerName and not by IP address, then there could be more than one endpoint defined on that server (another SQL instance perhaps) that is listening on that port. Though the status of the endpoint on the instance in question shows «STARTED», another instance may actually have the port bound and prevent the correct instance from listening and establishing TCP connections.
-
If Test-NetConnection fails to connect, look for Firewall and/or Anti-virus software that may be blocking the endpoint port in question. Check the firewall setting to see if it allows the endpoint port communication between the server instances that host primary replica and the secondary replica (port 5022 by default).
Run the following PowerShell script to examine for disabled inbound traffic rules -
If you’re running [!INCLUDEssNoVersion] on Azure VM, additionally you would need to ensure Network Security Group (NSG) allows the traffic to endpoint port. Check the firewall (and NSG, for Azure VM) setting to see if it allows the endpoint port communication between the server instances that host primary replica and the secondary replica (port 5022 by default)
Get-NetFirewallRule -Action Block -Enabled True -Direction Inbound |Format-Table
-
Capture the output from Get-NetTCPConnection cmdlet (equivalent of NETSTAT -a) and verify the status is a LISTENING or ESTABLISHED on the IP:Port for the endpoint specified
Listener
For correct configuration of an Availability Group listener follow «Configure a listener for an Always On availability group»
-
Once the listener is configured you can validate the IP address and port it is listening on by using the following query:
$server_name = $env:computername #replace this with your sql instance "serverinstance" sqlcmd -E -S$server_name -Q"SELECT dns_name AS AG_listener_name, port, ip_configuration_string_from_cluster FROM sys.availability_group_listeners"
-
You can also find the listener information together with the SQL Server ports using this query:
$server_name = $env:computername #replace this with your sql instance "serverinstance" sqlcmd -E -S($server_name) -Q("SELECT convert(varchar(32), SERVERPROPERTY ('servername')) servername, convert(varchar(32),ip_address) ip_address, port, type_desc,state_desc, start_time FROM sys.dm_tcp_listener_states WHERE ip_address not in ('127.0.0.1', '::1') and type <> 2")
-
If you need to establish connectivity to the listener and suspect a port is blocked, you can perform a test using the PowerShell Test-NetConnection cmdlet (equivalent to telnet).
$listener_name = "your_ag_listener" $IP_address = "your_ip_address" $port_number = "your_port_number" Test-NetConnection -ComputerName $listener_name -Port $port_number Test-NetConnection -ComputerName $IP_address -Port $port_number
-
Finally, check if the listener is listening on the specified port:
$port_number = "your_port_number" Get-NetTCPConnection -LocalPort $port_number -State Listen
Endpoint Access (SQL Server Error 1418)
This [!INCLUDEssNoVersion] message indicates that the server network address specified in the endpoint URL can’t be reached or doesn’t exist, and it suggests that you verify the network address name and reissue the command.
Join Database Fails (SQL Server Error 35250)
This section discusses the possible causes and resolution of a failure to join secondary databases to the availability group because the connection to the primary replica isn’t active. This is the full error message:
Msg 35250 The connection to the primary replica is not active. The command cannot be processed.
Resolution:
Summary of steps is outlined below.
For detailed step-by-step instructions, refer to Engine error MSSQLSERVER_35250
- Ensure the endpoint is created and started.
- Check if you can connect to the endpoint via Telnet and ensure no firewall rules are blocking connectivity
- Check for errors in the system. You can query the sys.dm_hadr_availability_replica_states for the last_connect_error_number that may help you diagnose the join issue.
- Ensure the endpoint is defined so it correctly matches the IP/port that AG is using.
- Check whether the network service account has CONNECT permission to the endpoint.
- Check for possible name resolution issues
- Ensure your [!INCLUDEssNoVersion] is running a recent build (preferably the latest build to protect from running into fixed issues.
Read-Only Routing is Not Working Correctly
-
Ensure that you have set up read-only routing by following Configure read-only routing document.
-
Ensure Client Driver Support
The client application must use a client provider that support
ApplicationIntentparameter. See Driver and client connectivity support for availability groups[!NOTE]
If you are connecting to a distributed network name (DNN) Listener, the provider must also supportMultiSubnetFailoverparameter -
Ensure connection string properties are set correctly
For read-only routing to work properly, your client application must use these properties in the connection string:
- A database name that belongs to the AG
- An availability group listener name
- If you’re using DNN, you must specify DNN listener name and DNN port number
<DNN name,DNN port>
- If you’re using DNN, you must specify DNN listener name and DNN port number
- ApplicationIntent set to ReadOnly
- MultiSubnetFailover set to true is required for Distributed network name (DNN)
Examples
This example illustrates the connection string for .NET System.Data.SqlClient provider for a virtual network name (VNN) listener:
Server=tcp:VNN_AgListener,1433;Database=AgDb1;ApplicationIntent=ReadOnly;MultiSubnetFailover=True
This illustrates the connection string for .NET System.Data.SqlClient provider for a distributed network name (DNN) listener:
Server=tcp:DNN_AgListener,DNN_Port;Database=AgDb1;ApplicationIntent=ReadOnly;MultiSubnetFailover=True
[!NOTE]
If you are using command line programs like SQLCMD, ensure that you specify the correct switches for server name. For instance, in SQLCMD you must use the upper case -S switch that specifies server name, not the lower case -s switch which is used for column separator.
Example:sqlcmd -S AG_Listener,port -E -d AgDb1 -K ReadOnly -M -
Ensure that the availability group listener is online. To ensure that the availability group listener is online run the following query on the primary replica:
SELECT * FROM sys.dm_tcp_listener_states;
If you find the listener is offline, you can attempt to bring it online using a command like this:
ALTER AVAILABILITY GROUP myAG RESTART LISTENER 'AG_Listener'; -
Ensure READ_ONLY_ROUTING_LIST is correctly populated. On Primary replica, ensure that the READ_ONLY_ROUTING_LIST contains only server instances that are hosting readable secondary replicas.
To view the properties of each replica you can run this query and examine the connectivity endpoint (URL) of the read only replica.
SELECT replica_id, replica_server_name, secondary_role_allow_connections_desc, read_only_routing_url FROM sys.availability_replicas;
To view a read-only routing list and compare to the endpoint URL:
SELECT * FROM sys.availability_read_only_routing_lists;
To change a read-only routing list you can use a query like this:
ALTER AVAILABILITY GROUP [AG1] MODIFY REPLICA ON N'COMPUTER02' WITH (PRIMARY_ROLE (READ_ONLY_ROUTING_LIST=('COMPUTER01','COMPUTER02')));
For more information see Configure read-only routing for an availability group — SQL Server Always On
-
Check that READ_ONLY_ROUTING_URL port is open. Ensure that the Windows firewall is not blocking the READ_ONLY_ROUTING_URL port. Configure a Windows Firewall for database engine access on every replica in the read_only_routing_list and any for clients that will be connecting to those replicas.
[!NOTE]
If you are running [!INCLUDEssNoVersion] on Azure VM, you must take additional configuration steps. Ensure that the network security group (NSG) of each replica VM allows traffic to the endpoint port and the DNN port, if you are using DNN listener. If you are using VNN listener, you must ensure the load balancer is configured correctly. -
Ensure that the READ_ONLY_ROUTING_URL (TCP://system-address:port) contains the correct fully qualified domain name (FQDN) and port number. See:
- Calculating read_only_routing_url for Always On
- sys.availability_replicas (Transact-SQL)
- ALTER AVAILABILITY GROUP (Transact-SQL)
-
Ensure proper SQL Server Networking configuration in the [!INCLUDEssNoVersion] Configuration Manager.
Verify on every replica in the read_only_routing_list that:
- [!INCLUDEssNoVersion] remote connectivity is enabled
- TCP/IP is enabled
- The IP addresses are configured correctly
[!NOTE]
You can quickly verify all of these are properly configured if you can connect from a remote machine to a target secondary replica’s [!INCLUDEssNoVersion] instance name usingTCP:SQL_Instancesyntax.
See: Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager) and View or Change Server Properties (SQL Server)
Related Tasks
-
Creation and Configuration of Availability Groups (SQL Server)
-
Create a Database Mirroring Endpoint for Windows Authentication (Transact-SQL)
-
Specify the Endpoint URL When Adding or Modifying an Availability Replica (SQL Server)
-
Manually Prepare a Secondary Database for an Availability Group (SQL Server)
-
Troubleshoot a Failed Add-File Operation (Always On Availability Groups)
-
Management of Logins and Jobs for the Databases of an Availability Group (SQL Server)
-
Manage Metadata When Making a Database Available on Another Server Instance (SQL Server)
Related Content
-
View Events and Logs for a Failover Cluster
-
Get-ClusterLog Failover Cluster Cmdlet
-
SQL Server Always On Team Blog: The official SQL Server Always On Team Blog
See Also
Transport Security for Database Mirroring and Always On Availability Groups (SQL Server)
Client Network Configuration
Prerequisites, Restrictions, and Recommendations for Always On Availability Groups (SQL Server)
Error 1418 is a common, hard-to-troubleshoot error. It is so common that it has been given its own page dedicated to the error in Books Online: MSSQLSERVER_1418. Unfortunately, that page only lists a few troubleshooting steps. Over the years, I’ve compiled a longer list of troubleshooting steps for this error. I’ve encountered every one of these issues at some point.
The server network address “%.*ls” can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational.
- Verify service accounts
- SQL Server service account requires CONNECT permissions to partners’ endpoints
- Best option is to use domain accounts for all partners
- If using Local Service or Local System, must use certificate authentication
- Ensure that the start date of the certificate is the current date or a day in the past relative to all servers. Due to time zone differences, if the current date on the server is earlier than the start date of the certificate, endpoint authentication will fail. Set the START_DATE option of the certificate to the day prior to when you are creating it to ensure it will work in all time zones.
- If using Network Service, must use the computer account (domainComputer$)
- Windows permissions are irrelevant. Do NOT add to local admins group
- Check the SQL log for errors
- Verify ports
- Use Telnet to test that the port is open and something is listening
- Good for verifying that port not blocked by firewall
- Does not verify that SQL Server is the process on the other end
- Use the netstat command to determine that the SQL instance is listening on that port
- Get the process ID of the instance using SERVERPROPERTY(‘processid’)
- On Windows Server 2003 SP1+: netstat -abn
- On Windows Server 2003 pre-SP1: netstat -ano
- Verify the process ID if there is more than 1 instance on the server
- Confirm that there are no other SQL instances on the server
- If other instances, check for mirroring endpoints
- If other mirroring endpoints, make sure they are using different ports and/or IP addresses
- IP address and port must be a unique combination
- Make sure firewall is not blocking the port
- Make sure firewall is allowing traffic both directions
- Use Telnet to test that the port is open and something is listening
- Verify all instances can access every other partner
- Ping each partner from each of the other partners
- Perform a tracert to each partner from each of the other partners
- If ping or tracert fails double check the ports (see above)
- Verify that the IP address the names resolve to are the correct IP addresses (don’t trust them)
- Verify that you are using the fully qualified domain name
- Do not use IP address, there are bugs with this
- Do not use just server name
- Verify endpoints
- Make sure all endpoints are started
- Use sys.database_mirroring_endpoints
- Ensure that all endpoints are using the same encryption algorithm
- Use sys.database_mirroring_endpoints
- Ensure that the OS supports the chosen encryption algorithm on all partners
- Windows 2000 does not support the default encryption algorithm (RC4)
- Make sure the queue for the endpoint is running
- Queue can be stopped by too many failures
- Drop and recreate the endpoint to start the queue
- Make sure all endpoints are started