Create a route from the primary Replication Server to the replicate Replication Server to establish a sample replication.
isql -Usa -STOKYO_RS
create route to SYDNEY_RS set username SYDNEY_RS_rsi set password SYDNEY_RS_rsi_ps go
isql -Usa -STOKYO_DS
sp_addlogin repsys, repsys_ps
go
use pubs2
go
sp_adduser repsys
go
grant select on authors to repsys
grant select on titles to repsys
go
quit
isql -Usa -STOKYO_RS
create user repsys
set password repsys_ps
go
grant create object to repsys
go
quit
isql -Usa -SSYDNEY_RS
create user repsys
set password repsys_ps
go
grant create object to repsys
go
quit
isql -Urepsys -Prepsys_ps -STOKYO_RS
create replication definition authors
with primary at TOKYO_DS.pubs2
with all tables named 'authors'
(
au_id varchar(11),
au_lname varchar(40),
au_fname varchar(20),
phone char(12),
address varchar(40),
city varchar(20),
state char(2),
country varchar(12),
postalcode char(10)
)
primary key (au_id)
searchable columns (state, postalcode)
go
create replication definition titles
with primary at TOKYO_DS.pubs2
with all tables named 'titles'
(
title_id varchar(6),
title varchar(80),
type char(12),
pub_id char(4),
price money,
advance money,
total_sales int,
notes varchar(200),
pubdate datetime,
contract bit
)
primary key (title_id)
searchable columns (type, pub_id)
go
isql -Usa -STOKYO_DS
use pubs2
go
sp_setreptable authors, true
go
sp_setreptable titles, true
go
isql -Usa -SSYDNEY_DS
use pubs2
go
grant select, insert, delete, update
on authors to pubs2_maint
grant select, insert, delete, update
on titles to pubs2_maint
go
isql -Urepsys -Prepsys_ps -SSYDNEY_RS
create subscription authors_sub
for authors
with replicate at SYDNEY_DS.pubs2
without materialization
go
create subscription titles_sub
for titles
with replicate at SYDNEY_DS.pubs2
without materialization
go