While attempting to remove Persistent Chat from one of my client’s environments I came across an issue removing the persistent chat database MGC. I could successfully remove the service from the persistent chat servers but when I got to the second step of the to do list I received the below error.
It appears this command only works if the server is present in topology. I however did not want to attempt to add the server back to topology as this seemed counterproductive. So, I attempted to run the uninstall-csdatabase command hoping I could just delete the databases from each server. This did not work either. I received an error stating this command could not be run against a mirrored database. At this point I was ready to play hard ball. I figured if I can break the mirror on the MGC database I then would be able to run the uninstall-csdatabase command. To do this I logged onto the primary SQL server backend that housed the MGC database and ran the following query from SQL Management Studio ALTER DATABASE mgc SET PARTNER OFF. I was then able to run the 3rd step of the to do list successfully (uninstall-csdatabase). I then noticed the mgc database was still present on the 2nd previously mirrored SQL server. From that server’s SQL Management Suit I ran this query RESTORE DATABASE mgc WITH RECOVERY. After running that command, I was then able to run the uninstall-csdatabase command against the 2nd SQL server and remove the mgc database.