Scenario for Coordinating Replication Definition Changes with Transfers to Object Ownership

You must immediately follow any change to table ownership at the primary database with the corresponding changes to affected replication definitions to ensure replication proceeds correctly.

This example shows how to coordinate transfers to table ownership at an Adaptive Server primary database with the corresponding changes to affected table replication definitions.

  1. Create the authors_repdef replication definition for the authors table at the pubs2 database in the NY_DS data server with Mario as the table owner. At the primary Replication Server enter:
    create replication definition authors_repdef
    with primary at NY_DS.pubs2
    with primary table named mario.authors
  2. Mark the table for replication and specify that the owner of the primary table must match the replicate table owner for replication to proceed. At pubs2 primary database enter:
    sp_setreptable mario.authors, 'true', owner_on
  3. The database administrator or owner transfers ownership of the authors table from Mario to Angela at pubs2:
    alter table mario.authors
    modify owner angela
  4. Verify if authors_repdef is the only replication definition affected by the change in table ownership from Mario. At the Replication Server enter:
    rs_helpreptable pubs2, mario, *
    If there is more than one replication definition affected by the change in table ownership, you can modify all replication definitions in one commmad using the wildcard character.
  5. You must change authors_repdef immediately to maintain seamless replication and data integrity at the replicate database. At pubs2 enter:
    exec rs_send_repserver_cmd ‘alter replication 
    definition authors_repdef
    alter primary owner from mario to angela’