Force the servers to switch roles without stopping the mirroring system.
Prérequis
This lesson assumes that you have completed all preceding lessons. See Lesson 1: Creating a database mirroring system.
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.
Connect to the primary server. Run the following command:
dbisql -c "UID=DBA;PWD=sql;SERVER=mirror_demo_primary;HOST=localhost:6871,localhost:6872" |
Use the ServerName database server property to determine the name of the server that is currently the primary server.
SELECT PROPERTY( 'ServerName' ); |
The name of the primary server appears (mirror_server1).
The ServerName database server property returns the real name, not the alternate name, of the server.
Initiate the failover by executing the ALTER DATABASE SET PARTNER FAILOVER statement
ALTER DATABASE SET PARTNER FAILOVER; |
Connections to the primary server close. The database server messages window for server2 displays a message indicating that it is the new primary server:
Connect to the current primary server:
dbisql -c "UID=DBA;PWD=sql;SERVER=mirror_demo_primary;HOST=localhost:6871,localhost:6872" |
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' ); |
Execute the following statement to verify that all transactions were mirrored to the mirror database:
SELECT * FROM test; |
Disconnect from Interactive SQL.
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |