Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Need to replicate multiple databases (publications) to one central subscriber Expand / Collapse
Author
Message
Posted Monday, November 26, 2007 3:27 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, September 11, 2014 7:22 PM
Points: 222, Visits: 246

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



Post #426070
Posted Monday, November 26, 2007 3:33 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, September 29, 2014 9:31 AM
Points: 354, Visits: 916
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
Post #426077
Posted Friday, August 27, 2010 1:24 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 27, 2010 5:11 AM
Points: 3, Visits: 2
Thanks a million ChrisB !! You are awesome.. I had the similar issue and got resolved...
Post #976197
Posted Friday, August 27, 2010 5:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 27, 2010 5:11 AM
Points: 3, Visits: 2
Chris if you can solve this..

http://www.sqlservercentral.com/Forums/Topic976280-291-1.aspx
Post #976284
Posted Friday, August 27, 2010 10:22 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, September 29, 2014 11:36 AM
Points: 361, Visits: 880
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/
Post #976562
Posted Tuesday, September 11, 2012 3:02 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 5:49 AM
Points: 102, Visits: 333
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
Post #1357212
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse