Groups | Blog | Home
all groups > sql server replication > november 2006 >

sql server replication : sp_changepublication


Frank
11/28/2006 5:43:48 PM
Good day all,

Is there anyway to run this to set the sync_method = 'native' without having
to also having to set the force_invalidate_snapshot = 1 ?

Here's what I'm trying to do:

SQL2000EE (SP4) on Win2000AS (SP4)
Transactional Replication
-Single Publisher/Distributor with one Publication (RMLP)
-Multiple Subscribers receiving PUSH Subscriptions from the Publisher

The initial setup worked beautifully, and has been running in production for
the past few months, now I need to add 3 additional tables to the existing
Publication so that they replicate over to the Subscribers. I only want the
Snapshot Agent to generate scripts and bcp data for the NEW tables created
on the Published DB instead of the entire Publication's articles.

I know when the Dist Agent runs it will only pick up the newly added
articles, but I've learned that certain factors appear to control the
Snapshot Agent's script article generation behavior (@article param) so I
set out to modify the requisite Publication properties to work the way I
want.

The initial Publication had been setup with allow_anonymous = true, and
immediate_sync = true, which I changed using the following:

exec sp_changepublication @publication = 'RMLP',
@property = 'allow_anonymous', @value = 'FALSE'
GO
exec sp_changepublication @publication = 'RMLP',
@property = 'immediate_sync', @value = 'FALSE'
GO

Now I was able to run this next script to add the new article, this was not
possible before I changed the properties above as it kept insisting that the
@article param = 'ALL'

exec sp_addarticle @publication = 'RMLP'
, @article = 'tbl_Content'
, @source_table = 'tbl_Content'
go

Now when I went to run this next script to add the article to one of the
subscriptions, it returns the message again that for concurrent snaphsot
generation (do not lock tables) it requires @article param = 'ALL' again
which I know will cause the Snapshot Agent to generate all articles again
and not what I desire.

exec sp_addsubscription @publication = 'RMLP'
, @article = 'tbl_Content'
, @subscriber = 'MLPDB2'
, @destination_db = 'RMLP'
go

So, I'm figuring I can just run the following and again modify the
properties of the Publication to change the sync_method to 'native' thereby
allowing the above to run without any error ?

exec sp_changepublication @publication = 'RMLP',
@property = 'sync_method', @value = 'native'
GO

Of course when I run the above, once again I get the message that in order
to apply this change I have to force_invalidate_snapshot = 1

It's been a bear of a learning experience attempting to mimic the exact same
setup as the PROD config in a test environment to iron out all these
snafus...but it would be disheartening to learn after all but achieving my
desired Snapshot Agent behavior, it might be all for naught if I can't get
past the last sync_method property change and have to let it regenerate the
entire 20 GB of articles again just for these few new tables.

Sorry for the long winded description, just wanted to provide as much info
as possible on what I've tried thus far.

Thanks in advance.

Frank

PS> Hilary, bought your book prior to setting up the inititial production
environment; it helped tremendously and is an excellent resource and
reference!! I thought I remember a paragraph somewhere in there that listed
a publication's property changes that require the force_invalidate_snapshot
to be set but couldn't locate it.


Hilary Cotter
11/28/2006 9:26:23 PM
Unfortunately not when your subscriptions are anonymous. Is it possible to
have a separate publication for these guys?

--
Hilary Cotter

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Frank
11/28/2006 10:27:39 PM
Hi Hilary,

Thanks for the speedy reply.

I got past that 'allow_anonymous' issue, by running these first two scripts
from my original post. This worked because when I view the Publication's
property's in the EM Publication Property dialog, the "allow anonymous"
checkbox is no longer checked.

[quoted text, click to view]

Where I'm getting stuck is trying to run the following without also passing
in the @force_invalidate_snapshot = 1 property.

[quoted text, click to view]

When I try to add the specific @article = 'mynewtablename' using
sp_addsubscription, it returns an error message that says because my
publication is set for sync_method = concurrent in the snapshot properties I
have to set @article = 'all'.

This is why I'm trying to change the sync_method property using
sp_changepublication.

I hope this helps clarify ?

Many thanks for your time and input.

Regards,

Frank

[quoted text, click to view]

Paul Ibison
11/29/2006 12:00:00 AM
Frank,

There are 2 unofficial workarounds which have been mentioned on this group
(which I haven't yet tested!): (a) you can circumvent the check by
specifying @reserve = 'internal' when you add the subscription for the new
article and the snapshot agent should generate snapshot for the new article
after that and (b) you could change the immediate_sync property in
syspublications to 0 (see sp_changepublication).
Other more official workarounds including changing the sync_method from
'concurrent' to either 'database snapshot' (enterprise edition only) and
'native' (which locks table during snapshot generation). Change the
sync_method will force a reinitialization of all your subscriptions at this
point. Alternatively you could create another publication and use this
instead.


Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

Frank
11/29/2006 9:53:03 AM
Hi Paul,

I'd seen that @internal = 'internal' workaround from Ray in this NG; but
given his caveat emptor, I didn't try it.

I'm ok with locking the tables during the snapshot as the website this
database serves will be down for maintenance whenever we need to add
table(s) to the publication. Originally, we ticked the "Concurrent"
snapshot in the properties dialog, then decided it wasn't necessary and when
we tried to uncheck it, the force invalidate/re-init warning dialog popped
up so we left it as is and it's been that way since.

I will get back to testing this weekend on a lab environment and use the
@internal workaround and report back to the NG the results.

Thank you for your time and suggestions.

Regards,

Frank


[quoted text, click to view]

bpilak NO[at]SPAM gmail.com
11/29/2006 7:44:22 PM
Hi every one
Where is the line on databases/log size for the database mirroring.
Does it make sense to set up high availability for database of size 600
GB with a transaction log of about 200 GB a day across a WAN of 1 GB
pipe. There are 5000 users with a peak concurrency of about 50%. When
do we resort in favour of clustering or other HA options.
Bhas
Frank
11/30/2006 3:37:56 PM
Hi Paul,

@reserved = 'internal' did the trick in my test environment !

I was able to successfully run sp_addsubscription whilst the publication is
still configured for sync_method = 'concurrent' and not receive any error.

When I ran the snapshot agent after issuing the sp_addsubscription commands,
it only created the snapshot for the new articles.

-Frank

[quoted text, click to view]

Paul Ibison
12/1/2006 12:00:00 AM
Thanks for the update Frank. Why not write a short article or blog about it?
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .




Frank
12/1/2006 10:44:27 AM
Hi Paul,

I'm flattered by the offer, however I'm not really the blogging type I hate
to say and I'd defer any article writing to the experts out there.
Hopefully this NG thread will be useful to someone else in the same
predicament I was in.

Again, many thanks for the assistance.

Regards,

Frank

[quoted text, click to view]

AddThis Social Bookmark Button