SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Need to replicate multiple databases (publications) to one central subscriber


Need to replicate multiple databases (publications) to one central subscriber

Author
Message
Chris Becker
Chris Becker
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1129 Visits: 279
Certainly - make sure all you repl stored procedures are in subscriber db. If lost you can recreate by executing the following on publisher, then take output and exec on subscriber: exec sp_scriptpublicationcustomprocs @publication = 'PubNameHere'

Also - good idea to initially set distribution agent profile to 'continue on data consistency errors..' - you will need to perform manual sync to make sure subscriber in sync w/ publisher.

Good luck.

ChrisB MCDBA
MSSQLConsulting.com



Ed7
Ed7
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3358 Visits: 935
Chris,

Apologies for misspelled your name!!!

Here is my database replication scripts:

use master
go

--- Create an entry on the sysserver tables, mark it as the Distributor
--- and stores property information.
--- heartbeat_interval in minutes
EXEC sp_adddistributor
@distributor = 'DistributorServerName',
@heartbeat_interval = 20, --- 20 minutes
@password = 'Password'
go

--- Create a new distribution database and install the Distribution schema
exec sp_adddistributiondb
@database = 'Tobe_Named_Distribution_Center',
@data_folder = 'D:\BnB_ReplData\sql_data',
@data_file = 'Tobe_Named_Distribution_Center.MDF',
@data_file_size = 100,
@log_folder = 'D:\BnB_ReplData\sql_log',
@log_file = 'Tobe_Named_Distribution_Center.LDF',
@log_file_size = 25,
@min_distretention = 24,
@max_distretention = 72,
@history_retention = 72,
@security_mode = 0,
@login = 'LoginID',
@password = 'Password'
GO


--- Configure a Publisher to use a specified distribution database
exec sp_adddistpublisher
@publisher = 'PublisherServerName',
@distribution_db = 'Tobe_Named_Distribution_Center',
@security_mode = 0,
@login = 'LoginID',
@password = 'Password',
@working_directory = N'\\MahcineName\D$\BnB_ReplData',
@trusted = 'true',
@thirdparty_flag = 0
GO

-- Add a subscriber server
EXEC sp_addsubscriber @subscriber = 'Subcriber Server Name'
,@type = 0
,@login = 'LoginID'
,@password = 'Password'
,@description = 'Subcriber Server Subscription'
,@security_mode = 0
GO

sp_addsubscriber_schedule @subscriber = 'Subcriber Server Name'
,@agent_type = 0
,@frequency_type = 4
,@frequency_interval = 1
,@frequency_relative_interval =1
,@frequency_recurrence_factor = 0
,@frequency_subday = 4
,@frequency_subday_interval = 10
,@active_start_time_of_day = 000700
,@active_end_time_of_day = 235959
,@active_start_date = 20071114
,@active_end_date = 99991231
GO


----- Need to switch the database
USE [SiteData]
GO

--- STEP 1 Configure the server/database for Snapshot replication
EXEC sp_replicationdboption @dbname = 'DabaseSiteData',
@optname = 'publish', @value = 'True'
GO

--- STEP 2 Creating and configuring the Snapshot Agen
--- Set a replication database option for the current database

-- Adding the transactional publication
exec sp_addpublication @publication = N'DatabaseSiteData',
@restricted = N'false',
@sync_method = N'native',
@repl_freq = N'continuous',
@description = N'Transactional publication of SiteData database from Publisher GHS0017RPT.',
@status = N'active',
@allow_push = N'true',
@allow_pull = N'true', @allow_anonymous = N'false',
@enabled_for_internet = N'false',
@independent_agent = N'false',
@immediate_sync = N'false',
@allow_sync_tran = N'false',
@autogen_sync_procs = N'false',
@retention = 336,
@allow_queued_tran = N'false',
@snapshot_in_defaultfolder = N'true',
@compress_snapshot = N'false',
@ftp_port = 21, @ftp_login = N'anonymous',
@allow_dts = N'false',
@allow_subscription_copy = N'false',
@add_to_active_directory = N'false',
@logreader_job_name = N'GHS0017RPT-SiteData-1'
GO


exec sp_addpublication_snapshot
@publication = N'DatabaseSiteData',
@frequency_type = 4,
@frequency_interval = 1,
@frequency_relative_interval = 1,
@frequency_recurrence_factor = 0,
@frequency_subday = 8,
@frequency_subday_interval = 1,
@active_start_date = 0,
@active_end_date = 0,
@active_start_time_of_day = 0,
@active_end_time_of_day = 235959,
@snapshot_job_name = N'BlaBlaBla'
GO




--- Adds a login to the publication's access list
exec sp_grant_publication_access
@publication = N'DabaseSiteData',
@login = N'LoginID'
GO

exec sp_grant_publication_access
@publication = N'DabaseSiteData',
@login = N'BUILTIN\Administrators'
GO

exec sp_grant_publication_access
@publication = N'DabaseSiteData',
@login = N'distributor_admin'
GO

---- Stop di sini
-- Adding the transactional articles
exec sp_addarticle @publication = N'DabaseSiteData',
@article = N't_EditTags',
@source_owner = N'dbo',
@source_object = N't_EditTags',
@destination_table = N't_EditTags',
@type = N'logbased',
@creation_script = null,
@description = null,
@pre_creation_cmd = N'drop',
@schema_option = 0x000000000000CEF3,
@status = 16,
@vertical_partition = N'false',
@ins_cmd = N'CALL sp_MSins_t_EditTags',
@del_cmd = N'CALL sp_MSdel_t_EditTags',
@upd_cmd = N'MCALL sp_MSupd_t_EditTags',
@filter = null, @sync_object = null,
@auto_identity_range = N'false'
GO
praveen2288
praveen2288
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 2
Thanks a million ChrisB !! You are awesome.. I had the similar issue and got resolved...
praveen2288
praveen2288
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 2
Chris if you can solve this..

http://www.sqlservercentral.com/Forums/Topic976280-291-1.aspx
Kendal Van Dyke
Kendal Van Dyke
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2836 Visits: 983
Whenever you have a central subscriber topology I recommend changing the default behavior for what to do if the table articles already exist at the subscriber. To do this open the publication's properties, select the articles page, right click on each article and choose set properties of this table article (or choose set properties of all table articles, but be careful as this applies to all articles and may change custom settings you've already set up for other table articles). In the Destination Object section change the property for Action if name is in use to Keep existing object unchanged.

Setting this property will allow you to apply the snapshot from each publisher as its added to the replication topology. Of course that assumes that you won't generate PK errors (which the OP suggested may happen). One way to avoid this in a central subscriber topology is to put a composite PK on each replicated table which includes a sysname column for the server name (with a default of @@servername). The added benefit is that you can tell where the row originated from when you're looking at the data on the central subscriber.

Kendal Van Dyke
http://kendalvandyke.blogspot.com/
SQL_Student
SQL_Student
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1048 Visits: 400
Hello there Vijay

Id like to know how did you get it to work as I tried the following scenario using SQL 2008 r2 but cannot get any success. The first publisher replicates the data fine but the second publisher overwrites all the data. Then the first one stops replicating
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search