all groups > sql server replication > august 2007 >
You're in the

sql server replication

group:

Schema Changes in Transactional Replication


Re: Schema Changes in Transactional Replication Hilary Cotter
8/15/2007 12:00:00 AM
sql server replication:
Answers inline. Not that if you are using SQL 2005 for both your publisher
and subscribers and are using the replicate_ddl option (by default this is
set to true), most schema changes will be replicated. PK changes will not be
and some other changes (i.e. adding identity properties, etc). If you do use
the replicate_ddl option typically only the tables you have modified will be
resnapshotted, this might be a better option for you than the way you are
doing it.

--
relevantNoise - dedicated to mining blogs for business intelligence.

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]
1) Yes, and it will not invalidate the snapshot unless you are using one of
the updateable subscribers options.

[quoted text, click to view]
This is a difficult to determine as the default snapshot option in SQL 2005
is concurrent snapshot option which means brief locks are held on the tables
as the snapshot it generated and then after the snapshot is applied on the
publisher the log is consulted to determine what has changed since the
watermark when the snapshot was generated and delta statements are built to
make the publisher and subscriber consitent. If the publisher is under load
this can be a significant amount of time to generate this delta.
[quoted text, click to view]

Schema Changes in Transactional Replication Freddy
8/15/2007 7:35:07 AM
Hi,

We're doing transactional replication. about 150 tables are being
replicated.

The people on our development team do frequent product releases, and as part
of this the schema of some replicated tables almost always changes. Their
procedure is:

1. remove relevant tables from replication, using the SSMS UI
2. make the schema changes on the publisher -- either using the SSMU UU, or
Red Gate's Sql Compare. often the changes are significant, including
changing the names of primary keys.
3. release the software
4. put the tables back into replication using the SSMS UI.
5. I then reinit the subscription using the SSMS UI, and get only the
option to use a New Snapshot and I normally select Mark for
Reinitialization, to force the new snapshot to be created immediately. (is
this correct?)

my questions are:
1. after step 1 above, will replication continue normally? does it
invalidate the snapshot? and if so, does this mean replication does not
continue normally, or does this just mean that the current snapshot will be
used, until a new one can be recreated?

2. is there a better way to do this so that the snapshot would not need
complete rebuilding?

3. how to determine how long it takes for a snapshot to be rebuilt? I have
looked at the various monitors but can't seem to find a direct answer to
this.

thanks for any help on this!

Fred


Re: Schema Changes in Transactional Replication Freddy
8/15/2007 11:13:07 AM
Hi Hilary,

Thanks so much for your answers.

re: If you do use the replicate_ddl option typically only the tables you
have modified will be resnapshotted, this might be a better option for you
than the way you are doing it.

This sounds good, but the better way you are indicating is not yet clear to
me.. we are indeed using SS 2005 on both publisher and subscriber, and the
publisher is the distributor. It is a push replication. And, replicate
schema changes is set to true. So, what would I do differently from steps 1
thru 5 below?

Now, regarding PK changes --as you've indicated,they don't get replicated. I
have a table whose primary key column name was changed, and the old name is
now a computed column (so the code doesn't break), and I'm getting the error
'The column "logpk" cannot be modified because it is either a computed
column or is the result of a UNION operator.' Unless you (or someone else
can suggest a better way), I was thinking to pull the table out of
replication using the UI, change the schema on the subscriber so it's the
same as the publisher, and then add that article back into the publication
article list. I'm not sure if replication will now start to work for this
table, or if I have to recreate the entire snapshot, or re-init the
subscriber? or, as you've hinted above, doing something that forces just the
changed article to be resnapshotted. (I've almost got these concepts
straight--perhaps a bit confused here.)

It occurs to me that using some of the system stored procedures might be an
alternative here.

Thanks for any clarification, and I hope this discussion helps others.

Fred

[quoted text, click to view]

Re: Schema Changes in Transactional Replication Freddy
8/17/2007 3:17:13 PM
Rre: If you do use the replicate_ddl option typically only the tables you
have modified will be resnapshotted, this might be a better option for you
than the way you are doing it.

--> Since I have not changed the default, my procedure below should only
resnapshot changed tables, right? can someone help me understand Hilary's
suggestion for a better option?

Thanks,

Fred


[quoted text, click to view]

AddThis Social Bookmark Button