Mirror - Configuring Endpoints
Mirror - DB Properties
Mirror - Error 927
Database dbname cannot be opened. It is in the middle of a restore. (Microsot SQL Server, Error:927)
The error comes when we click on Start Mirroring.
Steps which you will have followed to get to this point:
- Connect the principal server
- Take the latest full backup of the database for which mirroring is required
- Also take the latest transaction backup of this database
- Connect the mirror server (node)
- Restore the full and transaction backup on mirror server with "Restore with norecovery" option
- After this you come to principal server
- In SSMS (SQL server management studio): Connect the instance
- In Object explorer, expand the database list
- Right click the database (for which we need to configure the mirroring), select the option "Mirror"
- On this window, click on configure security
- Here you will get the option to configure the witness server, if you have the witness server then click "yes" or if you don't want to configure the security for witness server click "No" then click "Next"
- Here you will see the principal server intance window, Listener port number and Endpoint name , then "Next"
- Here you will see the Mirror server instance window, click "Connect". Select the mirror server instance then click "Connect"
- Automatically mirror listener port and endpoint will be filled, click "Next"
- Here you will see the service account window, no need to fill this, click "Next"
- Here you will see the complete the wizard window, click "Finish", then "Next"
- Then click "Start Mirroring"
- And here you will get the error: 927.
Actually this is not an error, this msg tell us that the database, for which you want to configure the mirror, is not fully restored; i.e. it's in the middle of the restore.
First Solution
For this we need to restore the latest transaction log backup on mirror server/mirror node. Then click on start mirroring again at principal node, and it will work.
Second Solution
If we have restored the full backup and the latest log backup as well and we are still getting error 927, then we need to execute the below-mentioned command as directed:
On Mirror Server run this
ALTER DATABASE <Database_Name> SET PARTNER = ‘TCP://<Principal Server>:5022’
Exp. : ALTER DATABASE Test SET PARTNER = ‘TCP://Testserver_Principal:5022’
On Principal Server run this
ALTER DATABASE <Database_Name> SET PARTNER = ‘TCP://<Mirror Server>:5022’
Exp. ALTER DATABASE Test SET PARTNER = ‘TCP://Testserver_Mirror:5022’
After execution of the above commands on respective mirror and principal server, mirroring will be configured successfully.