I recently implemented a Lync Server 2013 infrastructure with a mirrored Microsoft SQL backend. During the configuration of the mirror, a network interruption occurred which resulted in the creation of the mirror database failing. Once the network issue had been resolved, I attempted to recreate the mirror via the “Install Databases” option in the topology builder to find the process failed with the following error:
“Cannot setup mirroring because there is an error when validating the current database states on primary and mirror instances for the database “rtcxds”. Exception: System.InvalidOperationException: Cannot setup mirror database “rtcxds” because it already exists.”
Despite manually attempting to create the mirror via the Lync Server Management Shell, the error persisted. In order resolve the problem, the following was performed.
1. Open the SQL Management Studio on the primary database server and locate the affected database, in my case it was “rtcxds”.
2. Right click the database and click “Detach” and then click OK when the following window is displayed.
3. Open the SQL Management Studio on the mirror database server and locate the affected database.
4. Right click the database and click “Delete”, you won’t be able to detach this database as it is not the primary.
5. Remove the created database files on each SQL server and then open the Lync Server topology builder.
6. In the topology builder right click “Lync Server 2013″ and then click “Install Databases”.
7. Follow the install databases wizard and the mirror should now deploy correctly.