10

The failover server has status (Mirror, Disconnected, In recovery) and principal server has status (Principal, Disconnected).

What is the process to reconnect these servers?

1
  • Here's a related question that looks very similar to this one. Give it a look and see if it helps: Breaking and Restoring a mirror Here's are some quick steps on how to Pause or Resume Database Mirroring If you're still having trouble after reading through those, update your post with what you've all tried and we'll go from there.
    – Aaron
    Commented Jan 3, 2012 at 17:16

6 Answers 6

6

Sometimes restarting the mirroring endpoint on the principal server will resolve this.

To do this use the following T-SQL.

ALTER ENDPOINT Endpoint_Name STATE = STOPPED

ALTER ENDPOINT Endpoint_Name STATE = STARTED

To get the name of the endpoint.

SELECT * FROM sys.endpoints
WHERE type = 4

See KB 2490051 for more details.

1
  • 1
    I had to restart the endpoint on mirror server as KB suggest as 2nd option. Commented Dec 4, 2015 at 21:26
4

First, try to get them to reconnect with this T-SQL command on the principal:

ALTER DATABASE AdventureWorks2012 SET PARTNER RESUME;

If that fails, you've got a communications issue between the principal and the mirror, and that's where the fun begins. It can be anything from IP connectivity to security on the mirroring endpoints to different encryption methods. I'd recommend Robert Davis's book Pro SQL Server 2008 Mirroring if you need to get into deep troubleshooting.

2

In our case we're using certificate authentication for connecting mirroring endpoints, and the issue was because one of the certificates that the mirroring endpoints were using had expired.

You can check the expiration date of the certificate involved in endpoint authentication by doing a

SELECT * FROM sys.certificates  

If this is the case, you'll need to create new certificates for whatever expired, then do ALTER ENDPOINT after they have been been imported.

1

I fixed this issue by next steps, restarting endpoint just on PRIMARY didn't help

  1. On PRIMARY:

    SELECT * FROM sys.endpoints WHERE type = 4
    
    ALTER ENDPOINT Mirroring STATE = STOPPED
    
    ALTER ENDPOINT Mirroring STATE = STARTED
    
  2. On MIRROR:

    SELECT * FROM sys.endpoints WHERE type = 4
    
    ALTER ENDPOINT Mirroring STATE = STOPPED
    
    ALTER ENDPOINT Mirroring STATE = STARTED
    
  3. Back on PRIMARY:

    ALTER DATABASE PACXDSite SET PARTNER RESUME;
    
0

Case:

When you run below command on Principal server:

alter database  'Database_Name' set partner off

After running above command your DB goes in [mirror, disconnected] State on mirror server.

Resolution:

Step 1:Run below query on mirror

exec sp_resetstatus 'Database_Name'

Step 2: After running below command your DB will be available.

restore database 'Database_Name' with recovery

Note: Step 2 will take some time to recover.

1
  • This makes mirror totally disconnected and you have to establish mirroring again
    – Alexey F
    Commented Aug 5, 2015 at 15:48
0

If "RESUME PARTNER" doesn't work

ALTER DATABASE AdventureWorks2016 SET PARTNER RESUME;

I would break the mirror for that database(s) and reconfigure it.

--STEP 1 ON PRINCIPAL, break the mirror for a database

ALTER DATABASE AdventureWorks2016 SET PARTNER OFF;

--STEP 2 ON MIRROR, break the mirror for a database

ALTER DATABASE AdventureWorks2016 SET PARTNER OFF;

--STEP 3 ON MIRROR

RESTORE LAST FULL BACKUP DATABASE WITH NO RECOVERY 
RESTORE TRAN BACKUP DATABASE WITH NO RECOVERY

--STEP 4 ON MIRROR

ALTER DATABASE AdventureWorks2016 SET PARTNER = 'TCP://PRINCIPAL.MyDomain.COM:5022';

--STEP 5 ON PRINCIPAL

ALTER DATABASE AdventureWorks2016 SET PARTNER = 'TCP://MIRROR.MyDomain.COM:5022';

--STEP 6 ON PRINCIPAL, if a WITNESS was already configured

ALTER DATABASE AdventureWorks2016 SET WITNESS = 'TCP://WITNESS.MyDomain.COM:5022';

It is worth to mention that all of the above can be done during working hours as the principal database will always be online and available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.