after installing Lync server 2013 CU on Lync servers, time came to apply the updates to the SQL backend, checking the topology, I found that the SQL backend is mirrored.
checking the SQL mirror status using Get-CsDatabaseMirrorState cmdlet, I found that databases are divided between both SQL nodes whish should not
if you tried to apply the update to the backend anyway like my client did, you will get the following error with one difference which will be the name of the “database” effected in the error.
my client received 4 error from 4 different databases rtcxds, rtcshared, rgsconfig and rgsdyn
error stated “Error: Database “” exists but not accessible. it must be repaired manually or dropped and a new one created…”
so because the problematic databases are on the second node of the SQL mirror, this is found by using the Get-CsDatabaseMirrorState cmdlet, if the “StateOnPrimary” have the value “Mirror” this mean it is hosted on the mirror node, if it have the value “Primary” this mean it is on the Primary node.
trying to failback the database to the primary SQL node failed.
anyway, I logged in to the second SQL node and connected to the Lync instance and saw that the databases are on “Suspended” status
checking the rtcxds database’s properties and going to “Mirroring” I found that the Mirror says “Resume” which should be “Pause” if the mirror was working.
to fix the suspend status all I need to do is to click on “resume” this will cancel the suspend status and resume with the synchronization
I did that to each database in suspend status, the databases status should then change to “Synchronized”
after the status is fixed, I tried again to switch all databases to be hosted on the Primary SQL node you can do that using PowerShell, but I found a great tool by Lync MVP “James Cussen” – Lync Database Mirror Manager Tool
it make it easy to control the Mirror of your Lync backend, I started it, and using it I moved the databases from second node to the primary node – it do the same job as the PowerShell cmdlet Invoke-CsDatabaseFailover but with a GUI
by checking the box “Primary” in front of the “App” database and hitting “Invoke”, the tool moved the databases back to the Primary node.
double checking using PowerShell cmdlet Get-CsDatabaseMirrorState I can see that now all databases are hosted on the primary SQL node
now tried to apply the Lync CU to the backend, and it went through without any problems.
so here you go