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: Moving a partner server

To move a server in a database mirroring system to a different server without stopping the system, delete the mirror definitions of the current mirror server, create a new server, and add the new server to the mirroring system.


This tutorial relies on the database mirroring system described in Tutorial: Creating a database mirroring system.

You must have the MANAGE ANY MIRROR SERVER privilege.

This task involves backing up a copy of the database. Depending upon the backup method you choose, see the appropriate privileges for that method.

Contexte et remarques

In this tutorial, all the database servers are running on the same computer. However, each database server must be installed on a separate computer in a production environment, and references to localhost in the connection strings must be changed to the actual computer names.

  1. Connect to the partner server that you want to move, mirror_server2, and ensure that has the mirror role. You can only move a partner with the mirror role. If the server you want to connect to is the primary server, you must initiate a failover so that the mirror and primary servers switch roles. Run the following command:

    dbisql -c "UID=DBA;PWD=sql;SERVER=mirror_server2;HOST=localhost:6872" SELECT DB_PROPERTY( 'MirrorRole' )

    The mirroring role for the current server is returned.

    • If Mirror is returned, then mirror_server2 is currently the mirror.

    • If Primary is returned, then mirror_server2 is currently the primary and you must initiate a failover to make mirror_server2 the mirror. Run the following command to initiate a failover:

      dbisql -c "UID=DBA;PWD=sql;SERVER=mirror_server2;HOST=localhost:6871,localhost:6872" ALTER DATABASE SET PARTNER FAILOVER

      The roles of the two partner servers switch.

  2. Create a new directory for the new partner server. Run the following command:

    mkdir c:\server3
  3. Connect to the primary server. Run the following command:

    dbisql -c "UID=DBA;PWD=sql;SERVER=mirror_demo_primary;HOST=localhost:6871,localhost:6872" 
  4. Drop the partner definition of the server being moved by executing a DROP MIRROR SERVER statement. Execute the following statement:

    DROP MIRROR SERVER mirror_server2;

    The mirror database stops. If the mirror database is the only database running on the server, then the server also stops.

  5. Create a new partner definition for the server to become the new partner server. Execute the following statements:

  6. Update the primary and mirror definitions. Execute the following statements:

    ALTER MIRROR SERVER mirror_demo_primary AS PRIMARY 
    ALTER MIRROR SERVER mirror_demo_mirror AS MIRROR
  7. Make copies of the mirrored database file and transaction log from the primary server, and add them to c:\server3 by running the following command:

    dbbackup -c "UID=DBA;PWD=sql;SERVER=mirror_server1;DBN=mirror_demo"  c:\server3
  8. Start the new partner server with the -xp on option so it joins the mirroring system. Run the following command:

    dbsrv16 -n mirror_server3 -x "tcpip(PORT=6874)" -su sql "c:\server3\mirror_demo.db" -xp on
  9. Connect to the new partner server and verify that it is the mirror server. Run the following command:

    dbisql -c "UID=DBA;PWD=sql;SERVER=mirror_server3;HOST=localhost:6874" "SELECT DB_PROPERTY( 'MirrorRole' )" 

    This command returns Mirror.


The mirror system is running with the new partner server.


Ensure that clients connecting to the primary server or mirror server have their connection strings updated to specify the addresses of both partners in the Host connection parameter:

The connection string to the database on the primary server:


The connection string to the database on the mirror server: