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 123»»»

add article to replication without snapshotting entire DB. Expand / Collapse
Author
Message
Posted Monday, September 25, 2006 7:35 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 10, 2008 10:39 AM
Points: 26, Visits: 7

hi

I simply want to add an article to an existing publication WITHOUT creating a new snapshot of the entire database, but rather just a snapshot of the new items.

I can add the article just fine either through the EM or sp_addarticle, but when I come to start the snapshot agent, it copies out the enitre DB. This DB is 150GB and the subscriber is in France (im in UK) so im going to be old(er) and grey(er) by the time the snapshot is copied over.

how do I accomplish this simple, yet seemingly utterly impossible task (as I have been looking and posting all over the place.)

 

Thanks

 

Alastair Jones.

Post #310849
Posted Monday, September 25, 2006 8:44 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, June 9, 2014 6:02 AM
Points: 2,674, Visits: 697

it's really very easy .. here's an example for sql2k adding a table to transactional replication:-

--
-- add table to publication
--
exec dbo.sp_addarticle 'mypublication' ,@article='mytable',@source_table='mytable',@destination_table='mytable',
@force_invalidate_snapshot=1
go
--
-- refresh the subscription
--
exec dbo.sp_refreshsubscriptions  'mypublication'
go
--
--
-- now run the snapshot agent which will only update the object changed/ added new object
--
exec msdb.dbo.sp_start_job @job_name='xxxx 'mypublication'
go
--

get the name of  'mypublication'

 --

-- execute within the published database e.g. the database being replicated

-- to obtain the publication name

--

exec dbo.sp_helppublication

go

 

 

 



The GrumpyOldDBA
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
Post #310931
Posted Monday, September 25, 2006 8:51 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 10, 2008 10:39 AM
Points: 26, Visits: 7

ill buy you a beer if it works - cant test it at the moment as my box is being hammered by a previous attempt that then snapped the entire dbase.

 

cheers

 

Alastair Jones.

Post #310933
Posted Monday, September 25, 2006 8:57 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 10, 2008 10:39 AM
Points: 26, Visits: 7
forgive the newbie - where do I get the job name from?
Post #310937
Posted Monday, September 25, 2006 9:23 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 10, 2008 10:39 AM
Points: 26, Visits: 7

As I cant qualify

exec msdb.dbo.sp_start_job @job_name='xxxx

with the actual job name, I run this section alone from the EM...and I get a snap of the entire database....

 

can you tell me how to fine the job name to start the agent from QM so I can see if this makes a difference...also im running sql 2005 - dont know if that makes a difference in the SP's to run...

 

Thanks

 

Alastair Jones

Post #310949
Posted Tuesday, September 26, 2006 5:14 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 6:28 AM
Points: 905, Visits: 1,417

You can also just add the article through management studio.  Publication properties -- Articles.

It prompts you that a new snapshot must be generated, but only the change(s) will be applied to the subscriber.




Post #311171
Posted Friday, September 29, 2006 9:26 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, June 9, 2014 6:02 AM
Points: 2,674, Visits: 697

alistair - sorry for delay have responded!

you could probably do it through the GUI but it's not an auditable process within a controlled production environment so no use to me other than testing.

ps. this takes out an object

--do this in the publishing database

exec dbo.sp_dropsubscription  @publication='mypublication',@article='myobjecttodrop',
@subscriber='MYSERVER'
exec dbo.sp_droparticle @publication='mypublication',@article='myobjecttodrop',
@force_invalidate_snapshot=1
exec dbo.sp_refreshsubscriptions  'mypublication'
go
--

 

 

 



The GrumpyOldDBA
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
Post #312323
Posted Thursday, December 17, 2009 1:53 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, July 22, 2014 1:44 PM
Points: 78, Visits: 336
colin Leversuch-Roberts-108755 (9/25/2006)


it's really very easy .. here's an example for sql2k adding a table to transactional replication:-

--
-- add table to publication
--
exec dbo.sp_addarticle 'mypublication' ,@article='mytable',@source_table='mytable',@destination_table='mytable',
@force_invalidate_snapshot=1
go
--
-- refresh the subscription
--
exec dbo.sp_refreshsubscriptions 'mypublication'
go
--
--
-- now run the snapshot agent which will only update the object changed/ added new object
--
exec msdb.dbo.sp_start_job @job_name='xxxx 'mypublication'
go
--


Hi,

I tried to add an article withouth re-initializing replication yet it still began to bulk copy all of my data. I followed the instructions above. Any idea what I did wrong?
Post #835981
Posted Thursday, December 17, 2009 10:23 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, July 8, 2014 4:17 AM
Points: 1,101, Visits: 5,279
Why is a complete snapshot being generated when a new article is added (SQL 2005)?
--------------------------------------------------------------------------------
This is expected behaviour if you have a merge or snapshot publication. If you have a transactional publication, a snapshot of all articles will always be generated if the immediate_sync publication property is set to true. Typically, the immediate_sync publication property is set to true if you allowed anonymous subscriptions while creating the publication through the CreatePublication wizard. To prevent the complete snapshot, run the script below:

EXEC sp_changepublication
@publication = 'MainPub',
@property = N'allow_anonymous',
@value = 'false'
GO

EXEC sp_changepublication
@publication = 'MainPub',
@property = N'immediate_sync',
@value = 'false'
GO

This works.
Source:http://www.replicationanswers.com/Transactional.asp
Post #836128
Posted Friday, December 18, 2009 2:57 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Sunday, July 6, 2014 3:07 PM
Points: 2,242, Visits: 3,643
I came across with this article on adding an article to existing publication. Might help you.
http://deepakrangarajan.blogspot.com/2009/01/sql-2005-transaction-replication-adding.html






Pradeep Singh
Post #836196
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse