Execute Replication Definition Changes Directly at the Primary Database

Use the rs_send_repserver_cmd stored procedure to execute replication definition change requests directly at the primary database.

Replication Server supports rs_send_repserver_cmd for these replication definition RCL commands:

The syntax is:

exec rs_send_repserver_cmdrs_api

rs_api contains the replication definition you want to change.

For example, to drop the address, city, state, and zip columns from the authors replication definition at the primary database, enter:

exec rs_send_repserver_cmd ‘alter replication
definition authors drop address, city, state, zip’

When you execute rs_send_repserver_cmd at the primary database, the Replication Agent sends the RCL command stored in rs_api to the Replication Server, which then executes the RCL command. This ensures that Replication Server replicates the primary data with the proper replication definition version—primary data before the rs_send_repserver_cmd is replicated with the old replication definition version, while primary data after the rs_send_repserver_cmd is replicated with the new replication definition version.

You do not always need to issue replication definition change requests directly from a primary data server. For example, you can execute the alter replication definition request directly from the primary Replication Server in these situations:

Warning!   As Replication Server accepts all commands that Replication Agent sends to Replication Server, you must control access to rs_send_repserver_cmd at the primary database.

Changes to rs_locater Table

When you execute rs_send_repserver_cmd at the primary database, the Replication Server rs_locater system table stores the OQID of the RCL in type according to whether the RCL inside rs_api is executed:

  • Successfully – type C

  • Unsuccessfully – type F

When you execute sysadmin skip_bad_repserver_cmd for the RCL that failed, Replication Server updates the rs_locater entry to type S. Replication Server skips the failed command the next time Replication Agent sends the command.

See rs_locater in the Replication Server Reference Manual.