Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Database Administration » High availability and read-only scale-out systems » Database mirroring » Tutorial: Creating a database mirroring system with multiple databases that share an arbiter server

 

Lesson 2: Using and testing the database mirroring system

Test the configuration of the database mirroring system by initiating failover.

Prerequisites

This lesson assumes that you have completed all preceding lessons. See Lesson 1: Creating a database mirroring system with three databases and one arbiter server.

This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Creating a database mirroring system with multiple databases that share an arbiter server.

 Task
  1. Run the following command to start Interactive SQL and connect to database one on the primary server:

    dbisql -c "UID=DBA;PWD=sql;Server=primary_one;LINKS=TCPIP"
  2. Add sample data to the database by executing the following statements:

    CREATE TABLE test (col1 INTEGER, col2 CHAR(32));
    INSERT INTO test VALUES(1, 'Hello from server1');
    COMMIT;
  3. Determine which database server you are connected to by executing the following statement:

    SELECT PROPERTY( 'ServerName' );

    The name of the primary server appears.

  4. Disconnect from Interactive SQL.

  5. Initiate failover. Run the following command:

    dbstop -y -c "UID=DBA;PWD=sql;Server=server1"

    If a warning message appears indicating that the database server still has one connection, click Yes to shut it down. The database server messages window for server2 displays a message indicating that it is the new primary server.

  6. Restart Interactive SQL by running the following command:

    dbisql -c "UID=DBA;PWD=sql;Server=primary_one;LINKS=tcpip"
  7. Execute the following statement to see that you are now connected to server2:

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

    SELECT * FROM test;
  9. Disconnect from Interactive SQL, and shut down the arbiter and server2 database servers.

Results

The database mirroring system has failed over successfully, causing server2 to become the primary server. The database mirroring system is then shut down.

Next

(optional) Delete the c:\server1, c:\server2, and c:\arbiter directories.