-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathupgrade-replication-scri_10.sql
More file actions
53 lines (48 loc) · 1.53 KB
/
upgrade-replication-scri_10.sql
File metadata and controls
53 lines (48 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- Execute at the Subscriber
DECLARE @publication AS sysname
DECLARE @publisher AS sysname
DECLARE @publicationDB AS sysname
DECLARE @subscriber AS sysname
DECLARE @subscriptionDB AS sysname
SET @publication = N'NwdCustomersMerge'
SET @publisher = N'PUBSERVER'
SET @publicationDB = N'Northwind'
SET @subscriber = N'SUBSERVER'
SET @subscriptionDB = N'NorthwindReplica'
-- At the subscription database, create a pull subscription
-- to a merge publication.
USE [NorthwindReplica]
EXEC sp_addmergepullsubscription
@publisher = @publisher,
@publication = @publication,
@publisher_db = @publicationDB
-- Add an agent job to synchronize the pull subscription.
EXEC sp_addmergepullsubscription_agent
@publisher = @publisher,
@publisher_db = @publicationDB,
@publication = @publication,
@subscriber = @subscriber,
@subscriber_db = @subscriptionDB,
@distributor = @publisher
GO
-- Execute at the Publisher.
DECLARE @publication AS sysname
DECLARE @subscriber AS sysname
DECLARE @subscriptionDB AS sysname
SET @publication = N'NwdCustomersMerge'
SET @subscriber = N'MYSUBSERVER'
SET @subscriptionDB = N'NorthwindReplica'
-- Add a Subscriber, using the defaults.
USE [master]
EXEC sp_addsubscriber
@subscriber = @subscriber
-- Add a pull subscription to a merge publication.
USE [Northwind]
EXEC sp_addmergesubscription
@publication = @publication,
@subscriber = @subscriber,
@subscriber_db = @subscriptionDB,
@subscription_type = N'pull',
@subscriber_type = N'local',
@sync_type = N'automatic'
GO