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


Snapshot replication


Snapshot replication

Author
Message
SQLAssAS
SQLAssAS
Say Hey Kid
Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)

Group: General Forum Members
Points: 696 Visits: 1220
Using replication, the published tables can not be altered, so we can't add a field to a table. Why is this?

Is there a way around it?

Is it because the agent is constantly running? If we set the agent to only start up before the Snapshot was taken, would this let us change the tables?
Lempster
Lempster
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3189 Visits: 1657
For a snapshot publication, locks are held on the published tables for the duration of the snapshot generation process so you would not be able to modify the tables during the process, but a more pertinent question is; why are you running the snapshot agent constantly?

Regards
Lempster
SQLAssAS
SQLAssAS
Say Hey Kid
Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)

Group: General Forum Members
Points: 696 Visits: 1220
Thanks for the reply.

Its not the snapshot which is running constantly, i think that would be impossible.

When you set the subscription up, theres an option to set the "agent schedule" and this is running constantly. I was wondering if this is causing the issue?

If you click "run on demand only" will this start up when a new snapshot is created?
Lempster
Lempster
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3189 Visits: 1657
So is it the Distribution Agent that is running continuously? Your are definitely using Snapshot Replication and not Transactional Replication, right? How often do you generate a snapshot?
SQLAssAS
SQLAssAS
Say Hey Kid
Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)Say Hey Kid (696 reputation)

Group: General Forum Members
Points: 696 Visits: 1220
Yep using snapshot replication. A new Snapshot is created just once a day over night.
Lempster
Lempster
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3189 Visits: 1657
Ok, I think it must be the Distribution Agent that is set to run continuously because i've just gone through setting up Snapshot Replication between a couple of Test databases and the options that you mentioned are presented for the Distribution Agent.
However, I can make changes to the tables included in the Publication regardless of the frequency with which the Distribution Agent runs and that is what I expected because the Distribution Agent is unaware of any changes to a Publication - it just pushes (or pulls) the published articles to the Subscriber after a new snapshot has been generated.

What error do you get when you try to modify tables on the Publisher?
RatanDeep Saha
RatanDeep Saha
Right there with Babe
Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)

Group: General Forum Members
Points: 770 Visits: 693
You can not alter the table with out dropping and re-adding them , having distribution job running or not is irrelevant .

Steps to follow :

1. Remove the Table from the publication .
2. Add the filed in table
3. Re-add only one table which you changed .
4. Make sure immediate sync or anonymous is false .
5. Run the snapshot to pick only the table change you did not the whole snapshot publication .
Lempster
Lempster
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3189 Visits: 1657
sqldba725 (2/26/2014)
You can not alter the table with out dropping and re-adding them , having distribution job running or not is irrelevant .

Err...yes you can, I've tested that scenario today.
MyDoggieJessie
MyDoggieJessie
SSCertifiable
SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)

Group: General Forum Members
Points: 6662 Visits: 7393
If you attempt to modify a table that's currently being replicated, you will receive the following error
- Unable to modify table.
Cannot drop the table 'dbo.ts-services' because it is being used for replication.
To obtian a list of table that are replicated you can run:
select * from sys.objects where is_published = 1



To get around it you have to remove the article from the publication, make the change, then add it back into the publication.

How were you able to do this in your test?

______________________________________________________________________________
"Never argue with an idiot; They'll drag you down to their level and beat you with experience" ;-)
Lempster
Lempster
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3189 Visits: 1657
You are trying to drop the table; that's not modifying it. The OP wanted to add a field (column)...that's what I did in my test. It's also possible to modify the the replicated table directly at the Subscriber although of course any modification will be lost when a new snapshot is applied.

Regards
Lempster
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