Initializing Mirror Replication Agent

Before you can initialize a Mirror Replication Agent instance, the Mirror Replication Agent instance must be running, and connectivity to the primary database must be established. See “Starting Mirror Replication Agent” and “Setting up Mirror Replication Agent connectivity” for more information.

NoteBefore you initialize a Mirror Replication Agent, the primary database must be quiesced. The following procedure includes quiescing.

StepsInitializing a Mirror Replication Agent transaction log in the primary database

  1. Log in to the Mirror Replication Agent instance with the administrator login.

  2. Use the following command to determine if objects associated with this Mirror Replication Agent instance already exists in the primary database:

    ra_helpsysinfo
    

    When you invoke the ra_helpsysinfo command, Mirror Replication Agent returns a list of the transaction log base objects in the primary database if initialization completed successfully. If no information is returned, the transaction log does not exist in the primary database.

    If objects exist for the Mirror Replication Agent instance, you do not need to complete this procedure.

  3. If you want to use a particular string for the database object name prefix of the transaction log components, use the ra_config command to set the value of the pdb_xlog_prefix parameter:

    ra_config pdb_xlog_prefix, XXX
    

    Here, XXX is a one- to three-character string that is to be the new value of the pdb_xlog_prefix parameter, and the prefix string used in the database object names when the objects are created. The default value of the pdb_xlog_prefix parameter is ra_.

    NoteThe value of the pdb_xlog_prefix_chars parameter specifies the nonalphabetic characters that are allowed in the prefix string (the value of the pdb_xlog_prefix parameter). The primary data server may restrict the characters that can be used in database object names. See the Mirror Replication Agent Primary Database Guide for information about which characters are available for which database.

    You can also use ra_config to determine the current value of the pdb_xlog_prefix parameter:

    ra_config pdb_xlog_prefix
    

    When you invoke ra_config and specify a configuration parameter with no value, it returns the current value of that parameter.

  4. You must quiesce the primary database, or otherwise prevent any DDL operations that can change the database objects or schema.

    Log in to the primary data server with a user login that has appropriate permissions or authority, and quiesce the primary database (or execute the commands necessary to prevent any DDL operations that change the database objects or schema).

  5. Use the pdb_init command to initialize the primary database:

    pdb_init
    

    NoteWhen you invoke pdb_init, the command returns an error message if the Mirror Replication Agent objects (using the prefix string currently specified in the pdb_xlog_prefix parameter) already exist in the primary database.

    When you invoke the pdb_init command, Mirror Replication Agent does the following:

    • Checks the primary database for compatible settings.

    • Generates a SQL script that is run in the primary database. This script creates the Mirror Replication Agent objects.

    • Initializes the RASD with information from the primary database.

  6. To verify the correct initialization for the primary database, invoke the pdb_init command with the move_truncpt keyword, which sets the truncation point to the end of the primary database transaction log:

    pdb_init move_truncpt
    go
    

    A message should indicate that the procedure was successful.

  7. Quiesce the primary database. See “Quiesce the primary database” for details.

  8. Use the ra_init command, which initializes the Mirror Replication Agent system database by reading schema information and transaction log location information from the primary database:

    ra_init
    
  9. Release the quiesce hold on the primary database:

If the log-creation script executes successfully, the script is stored in a file named partinit.sql in the scripts/xlog/installed directory.

If the log-creation script does not execute successfully, the primary database is not changed, and the script is stored in a file named partinit.sql in the scripts/xlog directory.

Check the primary database error log to determine why the log-creation script did not execute successfully. To get the log-creation script to execute successfully, you may need to edit the script file. See Chapter 4, “Troubleshooting Mirror Replication Agent,” for more information.