I'm doing some tests to build one database with one mirror database and one witness.

so far, I'm failing in the first test, I want to kill the witness, then the Main database, and then put the Mirror database working as Main database.

So when I killed the witness,and then the Main database and did


but I got:

Msg 1455, Level 16, State 106, Line 1 The database mirroring service cannot be forced for database "MyDataBase" because the database is not in the correct state to become the principal database.

I've been watching this tutorial and in that video everything goes just has planed.

You can see here my databases and my query to see if I'm missing something.

enter image description here

I'm having the same problem with both principal and mirror up, I'm unable to force mirror to turn to principal.

What am I missing?

edit: I can put the mirror database up with these commands


but if I do this I loose my mirroring settings, and when the other database comes up, is not connected to this one.

migrated from stackoverflow.com Nov 8 '11 at 23:57

This question came from our site for professional and enthusiast programmers.

  • If both the mirror and the primary are up but the witness is gone then you can force a failover to the mirror by running "ALTER DATABASE mydb SET PARTNER FAILOVER" on the primary and the database on the mirror should become available and this will not trash the mirroring settings. – Jason Cumberland Mar 12 '12 at 16:21

Your secondary database needs to be in a "Restoring..." state. Can you verify that? When you restore the database on the secondary server, it needs to be with NORECOVERY to put it in this state.

  • do I need to do something to put it in that state? or am I just not waiting enough ? (my secondary database is "In recovery" eternally..) – RagnaRock Nov 7 '11 at 18:30
  • @RagnaRock in the object explorer, is there anything around the database on the secondary server? Does it say "Restoring..." per chance? – Thomas Stringer Nov 7 '11 at 22:57
  • if the primary server is conected it says "Restoring..." (and I cant do a force_service) if I stop the primary server says "In Recovery" and still cant force_service – RagnaRock Nov 8 '11 at 10:13

Backup your primary database and restore that to your mirror instance, then backup your primary log and restore that to the mirror instance, both with norecovery. After that you need to configure mirroring (with or without a witness) netween the primary and the mirror. After the mirroring has been configured you can force a failover by running "alter database mydb set partner failover" on the primary. Once the database fails over the old primary should show the database as "restoring" and the old mirror should show the database as accessible. To fail the database back to the old primary run the same statement on the mirror.

You can not "blow away" the witness if you want to have automatic failvoer, but if you don't want automatic failover then you don't need a witness anyway.


"Cannot alter database because database is not in the correct state to become the principal"

4 years later, but - This error occurs for two reasons:

  1. Database is not in Full safety mode. To fix: ALTER DATABASE dbname SET PARTNER SAFETY FULL

  2. Principal SQL DB can still be reached by SQL mirror, perhaps because the principal SQL instance is glitching but still technically reachable. To fix: Shut down the principal server or principal SQL instance.

Once successful, if you are able to restore the primary SQL server it will come back up as the mirror, and mirroring will be paused/suspended. Mirroring is still set up at this point, but you must manually resume mirroring, either via GUI or TSQL, for it to resynch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.