Sql-server – How to Setup SQL Server 2008 R2 Mirror

mirroringsql-server-2008

I am trying to set up SQL Server 2008 R2 mirroring but I am getting stuck with this error:

An error occurred while starting mirroring.

Additional Information:
Alter failed for Database 'MyDB'. (Microsoft.SqlServer.Smo)

An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)

The server network address "TCP://10.39.113.135:5022" can not be reached or does not
exist. Check the network address name and that the ports for the local an remote
endpoints are operational. (Microsoft SQL Server, Error: 1418)

  • I can ping 10.39.113.135 (the mirror) from the principal server.
  • I can connect with telnet to 10.39.113.135:5022 from the principal server
  • netstat -n shows that there are no connections on 5022, which means it's not being used by anything else
  • The endpoints configuration step executes properly, and I confirmed both ends are configured correctly by following these steps: http://msdn.microsoft.com/en-us/library/ms189127.aspx
  • I did prepare the backup DB which I recovered onto the mirror server with the NO RECOVERY clause

So any ideas why I'm getting error 1418?

Here's the info requested by Mark Storey-Smith:

Principal:

name                                                                                                                             endpoint_id principal_id protocol protocol_desc                                                local_net_address                                local_tcp_port type type_desc                                                    state state_desc                                                   is_admin_endpoint
-------------------------------------------------------------------------------------------------------------------------------- ----------- ------------ -------- ------------------------------------------------------------ ------------------------------------------------ -------------- ---- ------------------------------------------------------------ ----- ------------------------------------------------------------ -----------------
Dedicated Admin Connection                                                                                                       1           1            2        TCP                                                          NULL                                             NULL           2    TSQL                                                         0     STARTED                                                      1
Mirroring                                                                                                                        65536       1            2        TCP                                                          NULL                                             NULL           4    DATABASE_MIRRORING                                           0     STARTED                                                      0
TSQL Default TCP                                                                                                                 4           1            2        TCP                                                          10.55.31.223                                     1433           2    TSQL                                                         0     STARTED                                                      0
TSQL Default VIA                                                                                                                 5           1            5        VIA                                                          NULL                                             NULL           2    TSQL                                                         0     STARTED                                                      0
TSQL Local Machine                                                                                                               2           1            4        SHARED_MEMORY                                                NULL                                             NULL           2    TSQL                                                         0     STARTED                                                      0
TSQL Named Pipes                                                                                                                 3           1            3        NAMED_PIPES                                                  NULL                                             NULL           2    TSQL                                                         0     STARTED                                                      0

(6 row(s) affected)

Mirror:

name                                                                                                                             endpoint_id principal_id protocol protocol_desc                                                local_net_address                                local_tcp_port type type_desc                                                    state state_desc                                                   is_admin_endpoint
-------------------------------------------------------------------------------------------------------------------------------- ----------- ------------ -------- ------------------------------------------------------------ ------------------------------------------------ -------------- ---- ------------------------------------------------------------ ----- ------------------------------------------------------------ -----------------
Dedicated Admin Connection                                                                                                       1           1            2        TCP                                                          NULL                                             NULL           2    TSQL                                                         0     STARTED                                                      1
Mirroring                                                                                                                        65536       1            2        TCP                                                          NULL                                             NULL           4    DATABASE_MIRRORING                                           0     STARTED                                                      0
TSQL Default TCP                                                                                                                 4           1            2        TCP                                                          10.39.113.135                                    1433           2    TSQL                                                         0     STARTED                                                      0
TSQL Default VIA                                                                                                                 5           1            5        VIA                                                          NULL                                             NULL           2    TSQL                                                         0     STARTED                                                      0
TSQL Local Machine                                                                                                               2           1            4        SHARED_MEMORY                                                NULL                                             NULL           2    TSQL                                                         0     STARTED                                                      0
TSQL Named Pipes                                                                                                                 3           1            3        NAMED_PIPES                                                  NULL                                             NULL           2    TSQL                                                         0     STARTED                                                      0

(6 row(s) affected)

Best Answer

Have you checked the connection from mirror to principal with telnet? Have you restored a log backup at the mirror?

I posted a couple of diagnostic queries in an earlier q/a on mirroing. Run those and update your answer with the output.