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.
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" |
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; |
Determine which database server you are connected to by executing the following statement:
SELECT PROPERTY( 'ServerName' ); |
The name of the primary server appears.
Disconnect from Interactive SQL.
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.
Restart Interactive SQL by running the following command:
dbisql -c "UID=DBA;PWD=sql;Server=primary_one;LINKS=tcpip" |
Execute the following statement to see that you are now connected to server2:
SELECT PROPERTY ( 'ServerName' ); |
Execute the following statement to verify that all transactions were copied to the mirror database:
SELECT * FROM test; |
Disconnect from Interactive SQL, and shut down the arbiter and server2 database servers.
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |