Lesson 2: Initiating failover in a database mirroring system

 Create a failover in a database mirroring system
  1. Initiate failover. You can do this by stopping the primary server (currently mirror_server1) in one of the following ways:

    • Click Shut Down on the database server messages window.

    • Use the Windows Task Manager to end its task.

    • Run the following command:

      dbstop -y -c "UID=DBA;PWD=sql;SERVER=mirror_demo_primary"

      See Stopping a database server in a mirroring system.

    If a warning message appears indicating that the database server still has one connection, click Yes to shut it down.

    The arbiter database server messages window displays a message indicating that the primary server is disconnected.

    The arbiter database server messages window showing that server1 is disconnected.

    The database server messages window for mirror_server2 displays a message indicating that it is the new primary server:

    server2 database server messages window.
  2. Close Interactive SQL. If you receive an error message, click OK.

  3. Restart Interactive SQL by running the following command:

    dbisql -c "UID=DBA;PWD=sql;SERVER=mirror_demo_primary;HOST=localhost:6871,localhost:6872"
  4. Execute the following statement to verify that the server that was previously acting as the mirror server (mirror_server2) is now acting as the primary server:

    SELECT PROPERTY ( 'ServerName' );
  5. Execute the following statement to verify that all transactions were mirrored to the mirror database:

    SELECT * FROM test;
  6. Disconnect from Interactive SQL.

  7. Proceed to Lesson 3: Monitoring a database mirroring system.

 See also