By default, Replication Server is not installed with support for replication of Oracle sequence objects. Changes are required to Replication Server and the replicate Oracle database before replication of Oracle sequences is possible.
For Replication Server, you must create a replication definition that defines a stored procedure to assist with sequence replication. Execute the $SYBASE/RAX-15_2/scripts/oracle/oracle_create_rs_sequence_repdef.sql script against your primary Replication Server after editing the script to replace values {pds} and {pdb} with the name of your primary Replication Server connection. These values can also be found in the rs_source_ds and rs_source_db Replication Agent configuration properties.
The replication definition assumes that a database replication
definition exists. You may need to alter the definition if a database
replication definition does not exist. For details, see comments
in the oracle_create_rs_sequence_repdef.sql script.
In the replicate Oracle database, you must create a stored procedure to support sequence replication. Log into the replicate Oracle database as the maintenance user defined in your Replication Server connection to the replicate database. Execute the $SYBASE/RAX-15_2/scripts/oracle/ oracle_create_replicate_sequence_proc.sql script to create the necessary stored procedure.
The maintenance user defined in your Replication Server
connection to the replicate database must have sufficient privileges
to execute functions in the Oracle DBMS_SQL package. Also,
this maintenance user must have authority at the replicate Oracle
database to update any sequence that is replicated.
Marking a sequence for
replication
Log in to the Replication Agent instance with the administrator login.
Determine if the sequence is already marked in the primary database:
pdb_setrepseq pdb_seq
Here, pdb_seq is the name of the sequence in the primary database that you want to mark for replication.
If the pdb_setrepseq command returns information that the specified sequence is marked, you do not need to continue this procedure.
If the pdb_setrepseq command returns information that the specified sequence is not marked, continue this procedure to mark the sequence for replication.
Mark the sequence for replication.
The pdb_setrepseq command allows you to mark the primary sequence to be replicated and specify a different sequence name to use in the replicate database.
Use the following command to mark the sequence for replication when the sequence name you wish to increment at the replicate site has the same name:
pdb_setrepseq pdb_seq, mark
Here, pdb_seq is the name of the sequence in the primary database that you want to mark for replication.
Replicating a sequence with a different name that is
provided is consistent with other marking commands but is not a
typical configuration.
Use the following command to mark the sequence for replication using a different sequence name:
pdb_setrepseq pdb_seq, rep_seq, mark
Here, pdb_seq is the name of the sequence in the primary database that you want to mark for replication, and rep_seq is the name of the sequence in the replicate database that you wish to increment.
Replicating sequence values to a sequence with a different name
at the replicate site assumes that the replicate site sequence has the
same attributes and starting value as the primary site's sequence.
If the value of the pdb_dflt_object_repl parameter is true, the sequence marked for replication with the pdb_setrepseq command is ready for replication after you invoke the pdb_setrepseq command successfully.
If the value of the pdb_dflt_object_repl parameter is true (the default value), you can skip step 4 in this procedure.
If the value of the pdb_dflt_object_repl parameter is false, you must enable replication for the sequence before replication can take place.
Enable replication for the marked sequence:
pdb_setrepseq pdb_seq, enable
Here, pdb_seq is the name of the marked sequence for which you want to enable replication.
After replication is enabled for the sequence, you can begin replicating invocations of that sequence in the primary database.
To replicate a sequence, you must also run the oracle_create_replicate_sequence_proc.sql script
in the
$SYBASE/RAX-15_2/scripts/oracle directory
at the replicate site to create a procedure named rs_update_sequence.
Log in to the Replication Agent instance with the administrator login.
Confirm that the sequence is marked in the primary database:
pdb_setrepseq pdb_seq
Here, pdb_seq is the name of the sequence that you want to unmark.
If the pdb_setrepseq command returns information that the specified sequence is marked, continue this procedure to unmark the sequence.
If the pdb_setrepseq command does not return information that the specified sequence is marked, you do not need to continue this procedure.
Disable replication of the sequence:
pdb_setrepseq pdb_seq, disable
Here, pdb_seq is the name of the sequence that you want to unmark.
Remove the replication marking from the sequence:
pdb_setrepseq pdb_seq, unmark
Here, pdb_seq is the name of the sequence that you want to unmark.
To force the unmark, use the following command:
pdb_setrepseq pdb_seq, unmark, force
Confirm that the sequence is no longer marked for replication:
pdb_setrepseq pdb_seq
Here, pdb_seq is the name of the sequence in the primary database that you unmarked.