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

Snapshot replication Expand / Collapse
Author
Message
Posted Wednesday, February 26, 2014 2:38 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, October 15, 2014 5:14 AM
Points: 280, Visits: 854
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?
Post #1545279
Posted Wednesday, February 26, 2014 3:49 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 6:38 AM
Points: 2,126, Visits: 1,466
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
Post #1545306
Posted Wednesday, February 26, 2014 6:49 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, October 15, 2014 5:14 AM
Points: 280, Visits: 854
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?
Post #1545371
Posted Wednesday, February 26, 2014 7:21 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 6:38 AM
Points: 2,126, Visits: 1,466
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?
Post #1545382
Posted Wednesday, February 26, 2014 7:25 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, October 15, 2014 5:14 AM
Points: 280, Visits: 854
Yep using snapshot replication. A new Snapshot is created just once a day over night.
Post #1545384
Posted Wednesday, February 26, 2014 7:59 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 6:38 AM
Points: 2,126, Visits: 1,466
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?
Post #1545412
Posted Wednesday, February 26, 2014 8:42 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Wednesday, October 8, 2014 10:56 AM
Points: 611, Visits: 443
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 .
Post #1545441
Posted Wednesday, February 26, 2014 9:06 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 6:38 AM
Points: 2,126, Visits: 1,466
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.
Post #1545448
Posted Wednesday, February 26, 2014 9:29 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, October 16, 2014 6:18 PM
Points: 3,952, Visits: 7,170
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"
Post #1545463
Posted Wednesday, February 26, 2014 9:59 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 6:38 AM
Points: 2,126, Visits: 1,466
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
Post #1545477
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse