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

sql server replication : Replication on identity column


Satwinder
7/28/2006 6:31:02 AM
I have a column in table A with identity value. When i enable Transaction
replication on this table and sync the subscriber, it created the column with
int datatype Table A on subscriber.

I want the Subscriber to retain the identity column so that in case of
Publisher failure application can use subscriber.

How to achive this.

Paul Ibison
7/28/2006 2:50:00 PM
Use queued updating subscribers. This'll also take care of the identity seed
being useable on the subscriber.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

Hilary Cotter
7/28/2006 6:03:09 PM
What you have to do is

1) create the schema on the other side with the NFR attribute for the
identity property.
2) put the data in place
3) on the publisher have a seed of 1, and an increment of 2.
4) on the subscriber have a seed of 2 and an increment of 2.
5) issue a dbcc checkident(tablename) on the publisher to get the latest
assigned value. If its even, make it the next higher odd value.
6) issue a dbcc checkident(tablename) on the subscriber to get the latest
assigned value. If its odd, make it the next higher even value.
7) do a no sync subscription.

Using queued replication will introduce triggers and a guid column which may
or may not work for you. Queued is also designed for situations where the
majority of the DML originates on the publisher, and it is not scalable
beyond 10 subscribers.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

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]

Satwinder
7/31/2006 4:10:01 AM
Can i alter the custom Stored procs (sp_MSins_/sp_MSupd_,sp_MSdel) and achive
this.

Satwinder
[quoted text, click to view]
Hilary Cotter
7/31/2006 8:59:11 AM
Yes you can, but it offers very bad performance. Its simply not scalable.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

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]

Paul Ibison
7/31/2006 2:12:03 PM
You'll also have problems on failover, as the identity values will clash
(typically this'll cause PK problems).
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

Hilary Cotter
8/1/2006 12:00:00 AM
While this will work, setting identity_insert off and on in a proc before
doing an update is very expensive and can only be done on a single table at
a time. This will essentially cause any parallel operations to become
serialized.

I strongly do not recommend doing this as it simply is not a scalable
solution.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

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]

Satwinder
8/1/2006 4:32:02 AM
There is a very good article telling how to achive identity column
replication while maintaining the identity property at subscriber.

http://www.databasejournal.com/features/mssql/article.php/3483421

have a look at it.

cheers
Satwinder..

[quoted text, click to view]
Paul Ibison
8/1/2006 2:06:53 PM
Thanks for the link - in some senses though this is a manual way of
achieving the same thing that is automatic with queued updating subscribers
but anyway I must admit that I hadn't thought of this as a potential
solution before.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com



AddThis Social Bookmark Button