Common Repserver commands

a quick guide to some of the more common commands you’ll need;



Create connection


create connection to phoebe.sundry

set error class rs_sqlserver_error_class

set function string class rs_function_string_class

set username sundry_maint

set password sundry_maint_ps

with log transfer on


The log transfer on means that it will be able to replicate data as well as receive it.


Also rememebr that you have to add the database to the replication server by using rs_init in the install directory. This installs the stored procs and tables into the db as needed by the repserver.


Create replication definition


create replication definition rep1

with primary at phoebe.sundry

with all tables named ‘alpha1’ (a int, b char(10))

primary key (a)



Create subscription


create sybscription sub1

for rep1

with replicate at phoebe.sundry2



check subscription

check subscription sub1

For rep1

With replicate at phoebe.sundry2


You can also use the command rs_helpsub from the RSSD of the repserver.

resume connection


This restarts the dsi threads etc


resume connection to phoebe.sundry2

drop subscription

drop subscription sub1

for rep1

with replicate at phoebe.sundry2

This sometimes doesn’t work if this is the case then go into the RSSD database for the replication server and delete the relevant line from the rs_subscriptions table, you have to do this if you want to drop the connection.



Admin who


This will tell you what is up or down etc



Admin who_is_down


Tells you specifically what isn’t working

If it’s a connection then try to suspend the connection and resume it, if it’s a repagent then use sp_stop_rep_agent <dbname> from the dataserver and then sp_start_rep_agent <dbname> to get i8t working again, if that fails check the error log.



Rs_subcmp


This is a program which can be found in the bin directory of the Replication server installation, it is used to resyncronise the replicate database with the primary database, after a system failure, the sysadmin manual has an exstensive description of its use.


The best way to run this is to create a config file for it to run against. The config file will look something like;


PDS = TOKYO_DS

RDS = SYDNEY_DS

PDB = pubs2

RDB = pubs2

PTABLE = titleauthor

RTABLE = titleauthor

PSELECT = select au_id, title_id, au_ord, royaltyper from titleauthor order by au_id,\ title_id

RSELECT = select au_id, title_id, au_ord, royaltyper from titleauthor order by au_id,\ title_id

PUSER = repuser

RUSER = repuser

PPWD = piglet

RPWD = piglet

KEY = au_id

KEY = title_id

RECONCILE = Y

VISUAL = Y

NUM_TRIES = 3

WAIT = 10



If this file was called reconcile1.cfg then the command would be

rs_subcmp –f reconcile1.cfg


If you want to reconcile the primary database from the replicate database then you would swap around the PDB and RDB and also the PDS and RDS.  You could either have a separate file for this or use command line options, -d for the replicate database and –D for the primary database and then –s for the replicate dataserver and –S for the primary dataserver.




Sysadmin log_first_tran


This command will find the transaction which failed to be replicated, it’s run from the replication server controlling the database with the problem. It writes the output to the exceptions log. This consists of 3 tables in the RSSD for the Repserver, rs_excepthdr, rs_exceptcmd and rs_exceptslast.   These tables should be purged periodically after having fixed the problem.  You use rs_helpexception to see a list of the exceptions stored in the RSSD. And to delete it you would use rs_delexception.