How To establish mirroring session following domain name change

Have you ever needed to change the database mirroring partner names?

One of our clients had to transfer all their servers from one domain to a new one, including SQL server machines. So, they simply disconnected all servers from the old domain and connected them to the new one. Breath fluently, this was test environment.


It was a preview for a similar change planned to take place few weeks later in production environment. So, in order to be prepared for prod, I decided treating this case as if it was prod and doing all I can to re-establish mirroring connection without setting up mirroring from scratch.




The existing configuration of the database mirroring partners used FQDN names of this format: 'TCP://SERVERNAME.OldDomainName.com:port' as Microsoft suggests here and here.


(To check your mirroring configurations you can query table sys.database_mirroring)


So, now, following domain name change, the servers obviously cannot connect with each other and the databases involved in mirroring, are in status disconnected.


What needs to be done is changing the definition of mirroring partner FQDN names to consist of the new domain name instead of the old one. But it turned out it is not so straight forward.


Trying the following command:

ALTER DATABASE [DBName] SET PARTNER = 'TCP://SERVERNAME.NewDomainName.com:port'

Resulted in this error message:

Neither the partner nor the witness server instance for database "DBName" is available. Reissue the command when at least one of the instances becomes available.


Trying to change the configuration using IPs instead of server names like this:


ALTER DATABASE [DBName] SET PARTNER = TCP://xxx.xxx.xxx.xxx:port'


Didn't work as well. Same error.

I've verified connectivity between the servers using FQDN and port using 'telnet' utility in command line – works fine.


Tried to pause mirroring first, and only then execute the above ALTER commands – no change. Keep getting the same error.


Eventually, what I did was:


  1. Executing command ALTER DATABASE [DBName] SET PARTNER OFF first on secondary server, then on principal server. what resulted in breaking the mirror