Initializing Replication Agent

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

NoteBefore you initialize a Replication Agent that has an RASD, the primary database must be quiesced. Only Replication Agent for Oracle and Replication Agent for Microsoft SQL Server use an RASD. The following procedure includes quiescing.

StepsInitializing a Replication Agent transaction log in the primary database

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

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

    pdb_xlog
    

    If no Replication Agent objects exist, the pdb_xlog command returns no information. Continue this procedure to initialize Replication Agent. This procedure also creates objects in the primary database that support replication.

    NoteThe pdb_xlog command looks for Replication Agent objects based on the value of the pdb_xlog_prefix configuration parameter. If the value of the pdb_xlog_prefix parameter changed after a transaction log was created, the pdb_xlog command cannot find the previously created objects.

    If Replication Agent objects exist in the primary database, the pdb_xlog command returns a list of objects.

    If objects exist for the 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 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. If your Replication Agent has an RASD, you must quiesce the primary database, or otherwise prevent any DDL operations that can change the database objects or schema.

    Only the Replication Agent for Oracle and the Replication Agent for Microsoft SQL Server use an RASD.

    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_xlog command to initialize the Replication Agent transaction log:

    pdb_xlog init
    

    NoteWhen you invoke pdb_xlog with the init keyword, the command returns an error message if the 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_xlog command with the init option, the 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 Replication Agent objects.

    For Replication Agents that use an RASD, the RASD is initialized with information from the primary database.

    NoteYou can configure the Replication Agent to generate the script—but not execute it—by setting the value of the pdb_auto_run_scripts parameter to false before you invoke the pdb_xlog command. To complete the transaction log creation, you must set pdb_auto_run_scripts to true and rerun the pdb_xlog init command.

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 Replication Agent,” for more information.