Ads

11 January 2013

Replication Without Generating Snap Shot- step by step

--STEP1 - @PUBLISHER
select immediate_sync , allow_anonymous from syspublications

--STEP2 - @PUBLISHER
EXEC sp_changepublication @publication = 'DBNAME', @property =

N'allow_anonymous', @value='False'

Go

EXEC sp_changepublication @publication = 'DBNAME', @property =

N'immediate_sync', @value='false'

Go

--STEP3- @PUBLISHER DB
select immediate_sync , allow_anonymous from syspublications


--STEP4 ADD ARTICLES --@PUBLISHER DB

EXEC sp_addarticle @publication = 'DBNAME', @article ='ctxxxxxxxxxx',

@source_object='ctxxxxxxxx', @force_invalidate_snapshot=1

--STEP5 Verify if you are using CONCURRENT or NATIVE method for synchronization by running the following command.

select sync_method from syspublications --Here its 3

--STEP6 If the value is 3 or 4 then it is CONCURRENT and if it is 0 then it is NATIVE.If you are using the NATIVE method for synchronization then the parameter


--@reserved=’Internal’ is optional but there is no harm in using it anyways. But if it is CONCURRENT then you have to use that parameter. Else the next time you run the snapshot agent it is going to generate a snapshot for all the articles.

EXEC sp_addsubscription @publication = 'DBNAME', @article = 'ctxxxxxxxxx',

@subscriber ='PRA*******\SQL**', @destination_db = 'DBNAMEKKK',

@reserved='Internal'



--STEP 7
--start the SNAPSHOT AGENT job from the job activity monitor.

--STEP 8

--Verify that the snapshot was generated for only one article.

--REPEAT ADD artical and generate snapshot


-- Generate the snapshot
--http://thinknook.com/sql-replication-the-initial-snapshot-for-publication-is-not-yet-available-2012-04-19/

/*


    The Snapshot Agent did not run after a new subscription has been created: Basically if a new subscription is created, the Snapshot Agent needs to run once to generate a recent snapshot, in order to initialize a subscription.

    The Snapshot Agent did not run after a subscription has been initialized: Similar scenario to the above, if a subscription has been initialized you need to run the Snapshot Agent and generate a recent snapshot.

    A database that contains a subscription has been restored: If a database has been restored, you will need to initialize the subscription by generating a new Snapshot.


    */

No comments:

Post a Comment