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 » Maintaining a database mirroring system

 

Adding a mirrored database to a running mirroring system

Add a mirrored database to a running mirroring system without reducing the availability of the existing servers.

Prérequis

The primary and mirror servers must have been started using the -su database server option to set the password for the utility database. You must have the password for the utility database.

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

You must also have the MANAGE MIRROR SERVER privilege.

The arbiter and one partner of the existing mirroring system must be running.

The database that you are adding must have a transaction log.

Contexte et remarques

You have a mirroring system running and you want to use the existing partner and arbiter servers to mirror another database.

 Task
  1. Ensure that the arbiter server was started using the:

    • -xa database server option with the DBN parameter. Specify DBN=* to allow the arbiter server to accept connections for any mirrored database. Otherwise, specify all the databases that must be dynamically started and use this server as their arbiter.

    • -su database server option. You must be able to connect to the utility database on the arbiter server.

    For example:

    dbsrv16 -n mirror_arbiter -su sql -x "TCPIP(PORT=6870;DOBROAD=no)" -xf "c:\arbiter\arbiter.state" -xa "AUTH=abc;DBN=*" -o c:\arbiter\arbiter.conslog
  2. Copy the database that you want to mirror, along with its transaction logs, to one of the existing partner computers.

  3. Connect to the utility database on the existing partner server. For example:

    dbisql -c "UID=dba;PWD=sql;DBN=utility_db;SERVER=mirror_server1"
  4. Start the database to be added using the START DATABASE statement with the MIRROR ON and AUTOSTOP OFF clauses. For example:

    START DATABASE 'c:\\server1\\second.db' 
    AUTOSTOP OFF 
    MIRROR ON;

    The database starts.

  5. Connect to the database. For example:

    dbisql -c UID=DBA;PWD=sql;SERVER=mirror_server1;DBN=second

    Create the mirror server definitions (PRIMARY, MIRROR, ARBITER and both PARTNERS) and the authentication string with the SET MIRROR OPTION.

    The authentication string for the new mirroring system must match the authentication string specified by the arbiter's -xa option. The hostnames and ports must match those for the existing partner and arbiter servers. The PARTNER mirror server names must match the -n server option for the partner servers. The PRIMARY and MIRROR server names must not match any server names currently in use by the system.

    For example:



    CREATE MIRROR SERVER second_primary
    AS PRIMARY
    connection_string='SERVER=second_primary;HOST=localhost:6871,localhost:6872';
    
    CREATE MIRROR SERVER second_mirror
    AS MIRROR
    connection_string='SERVER=second_mirror;HOST=localhost:6871,localhost:6872';
    
    CREATE MIRROR SERVER mirror_server1
    AS PARTNER
    connection_string='SERVER=mirror_server1;host=localhost:6871'
    state_file='c:\\server1\\server1.state';
    
    CREATE MIRROR SERVER mirror_server2
    AS PARTNER
    connection_string='SERVER=mirror_server2;host=localhost:6872'
    state_file='c:\\server2\\server2.state';
    
    CREATE MIRROR SERVER arbiter_server
    AS ARBITER
    connection_string='SERVER=mirror_arbiter;HOST=localhost:6870';
    
    SET MIRROR OPTION authentication_string='abc';
  6. Create a backup of the database and copy the back up to the second partner server. For example, use the dbbackup utility.

    dbbackup -c "UID=DBA;PWD=sql;SERVER=mirror_server1;DBN=second" "c:\server2"
  7. Connect to the utility database on the second partner server. For example:

    dbisql -c "UID=DBA;PWD=sql;SERVER=mirror_server2;DBN=utility_db" 
  8. Start the database on the second partner server using the START DATABASE statement with the AUTOSTOP OFF MIRROR ON clause.

    START DATABASE 'c:\\server2\\second.db' 
    AUTOSTOP OFF 
    MIRROR ON;

Résultat

The newly added mirrored database should be running on both partners. Confirm that one partner has the role of Primary, and the other partner has the role of Mirror (either using the console log or DB_PROPERTY( 'MirrorRole' )).

 See also