Before you can initialize a transaction log, the Replication Agent instance must be running, and connectivity to the primary database must be established. See “Starting the Sybase Replication Agent” and “Setting up Replication Agent connectivity” for more information.
Before you initialize a Replication Agent that has a Replication
Agent System Database (RASD), the primary database must be quiesced.
Currently, only the Replication Agent for Oracle uses an RASD. The following
procedure includes quiescing.
To initialize a Replication Agent transaction log in
the primary database
Log in to the Replication Agent instance with the administrator login.
Use the following command to determine if a transaction log associated with this Replication Agent instance already exists in the primary database:
pdb_xlog
If a transaction log does not exist, the pdb_xlog command returns no information about transaction log objects. Continue this procedure to create a transaction log in the primary database.
The pdb_xlog command looks
for transaction log components 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
will not find the previously created transaction log objects.
If a Replication Agent transaction log exists in the primary database, the pdb_xlog command returns a list of the transaction log objects. For Replication Agent for Oracle, if replication has been initialized, it returns the Oracle database instance name.
If a transaction log exists for the Replication Agent instance, you do not need to complete this procedure.
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
where XXX is a one- to three-character string that will be the new value of the pdb_xlog_prefix parameter, and the prefix string used in the database object names of transaction log components when the transaction log is created. The default value of the pdb_xlog_prefix parameter is ra_.
The value of the pdb_xlog_prefix_chars parameter
specifies the non-alphabetic 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.
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.
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.
Currently, only the Replication Agent for Oracle uses an RASD.
Log in to the primary data server with a user login that has appropriate permissions or authority, and then quiesce the primary database (or execute the commands necessary to prevent any DDL operations that change the database objects or schema).
Use the pdb_xlog command to initialize the Replication Agent transaction log:
pdb_xlog init
When you invoke pdb_xlog with
the init keyword, the command returns an error
message if a transaction log (using the prefix string currently
specified in the pdb_xlog_prefix parameter)
already exists 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 transaction log base objects.
For Replication Agents that use a RASD, the RASD is initialized with information from the primary database.
You 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 manually execute that script
in the primary database.
If the log-creation script executes successfully, the script is stored in a file named create.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 create.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 Sybase Replication Agent,” for more information.