I'm testing SQL Server database mirroring and below is my topology.
- node2, principal
- node1, mirror
+-------------+--------------------------------------+-----------------+----------------------+----------------+---------------------+-------------------------+------------------------+-----------------------------+---------------------------+--------------------------+----------------------------+------------------------+-------------------------+------------------------------+------------------------+------------------------------+----------------------+---------------------------+--------------------------+---------------------------+
| database_id | mirroring_guid | mirroring_state | mirroring_state_desc | mirroring_role | mirroring_role_desc | mirroring_role_sequence | mirroring_safety_level | mirroring_safety_level_desc | mirroring_safety_sequence | mirroring_partner_name | mirroring_partner_instance | mirroring_witness_name | mirroring_witness_state | mirroring_witness_state_desc | mirroring_failover_lsn | mirroring_connection_timeout | mirroring_redo_queue | mirroring_redo_queue_type | mirroring_end_of_log_lsn | mirroring_replication_lsn |
+-------------+--------------------------------------+-----------------+----------------------+----------------+---------------------+-------------------------+------------------------+-----------------------------+---------------------------+--------------------------+----------------------------+------------------------+-------------------------+------------------------------+------------------------+------------------------------+----------------------+---------------------------+--------------------------+---------------------------+
| 1 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 2 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 3 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 4 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 5 | A66E5470-F1ED-47D5-83F4-C86A1F8E7833 | 4 | SYNCHRONIZED | 1 | PRINCIPAL | 4 | 1 | OFF | 6 | TCP://NODE1.dev.com:5022 | NODE1 | | 0 | UNKNOWN | 40000000038100001 | 10 | NULL | UNLIMITED | 40000000038100001 | 40000000038100001 |
+-------------+--------------------------------------+-----------------+----------------------+----------------+---------------------+-------------------------+------------------------+-----------------------------+---------------------------+--------------------------+----------------------------+------------------------+-------------------------+------------------------------+------------------------+------------------------------+----------------------+---------------------------+--------------------------+---------------------------+
Note that the safety level is off and I don't have a witness. Can I do a failover in this state? I tried:
ALTER DATABASE AdventureWorks2016 SET PARTNER FAILOVER;
But got this error:
Msg 1477, Level 16, State 1, Line 26
The database mirroring safety level must be FULL to manually failover database
"AdventureWorks2016". Set safety level to FULL and retry.
I also tried:
ALTER DATABASE AdventureWorks2016 SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS;
But got this error:
Msg 1455, Level 16, State 2, Line 27
The database mirroring service cannot be forced for database "AdventureWorks2016" because
the database is not in the correct state to become the principal database.
I checked the document and it seems there is no other commands to failover. Does that mean failover is impossible in this state and I have to change the safety level?