2. I need to set indentity_insert on. As far as I know it only in the code
level. Does anyone knows how to set it in db level so that I don't need to
add it in many sps.
Thanks in advance.
2. Unless you need it otherwise, use a value of 'manual' for the
@identityrangemanagementoption parameter for your call to
sp_addarticle. This will "do the right thing" with regards to
identity columns at the subscriber.
--
Ben
So I tried to remove the table from replication, but the error was still
sent out even though I remove it.
Any idea about it? thanks
"Ben Thul" wrote:
> .
>
But more importantly, 'replication support only' initialization only
applies in very specific circumstances. Specifically, when you can
guarantee that at the time the sp_addsubscriber statement is run that
the data and schema are identical. If they're not, you will encounter
issues where the distribution agent will try to run a statement
against data that doesn't exist (or something similar). If snapshots
aren't an option (and I still don't understand why they're not in your
specific case, but I'm moving past that), then initialization from
backup is a good option if you're in a SQL 2005+ environment.
--
Ben
"Ben Thul" wrote:
> > > > error in subscription and I need to remove the table from replicaiton.. But
> > > > the error is still there after I removed the table. The transaction in
> > > > distribition is still trying to insert that row to the table in subscriber. I
> > > > rememeber it was ok when I removed the table when I use initial snapshot
> > > > replication. Can anyone help how to remove a table and transaction related to
> > > > that table? so the error don't continue?
> >
> > > > 2. I need to set indentity_insert on. As far as I know it only in the code
> > > > level. Does anyone knows how to set it in db level so that I don't need to
> > > > add it in many sps.
> >
> > > > Thanks in advance.
> >
> > > .
>
> .
>
exec sp_removesubscription @publication = 'your pub here', @article =
'your article here'
exec sp_removearticle @publication = 'your pub here', @article = 'your
article here'
Then, when you go to re-add the article, use
@identityrangemanagementoption = 'manual'
Regarding your set up, I understand more where you're at now.
Essentially, you have a skinny OLTP and a fat archive. You want
replication to go between them and keep the parts that they have in
common in sync while leaving the old stuff alone. That's a tricky
setup. For instance, you have to be careful about how you replicate
deletes that happen at the publisher. If it were me, I might run a
slightly different topology: skinny OLTP, skinny subscriber, fat
archive where the archive is populated by a daily batch process (maybe
an SSIS package) from the skinny subscriber. You can get away without
the subscriber too, just running the archive update straight from the
OLTP. But, you can give replication a shot, too The advice above
should get you through your identity column issue.
--
Ben
"Ben Thul" wrote:
> .
>
As to identity columns, here's the deal: when you insert a row to a
table that has an identity column at the publisher, it'll generate a
value for that column (let's say for the sake of this conversation
that it's "275"). What you care about is that the value 275 makes it
to the subscriber(s). It doesn't matter if that column is an identity
column at the subscriber or not. In fact, it doesn't have to be
unless you have something besides replication inserting data into that
table. If you do have something else inserting into that table, you
will have to figure out what to do about identity ranges. That is,
you'll have to somehow explicitly assign a range of identity values
that will be inserted via replication and those by other means.
However, if replication is the only thing doing DML at the subscriber,
just let it do it how it needs to.
Rather than just trusting that I know what I'm talking about (which
you shouldn't!), I encourage you to set up something that mimics as
closely as possible your situation in a throw-away environment. You
should be able to get away with a schema-only copy of both the
publisher and subscriber. Set up the replication topology as you
would in your prod environment and give it a spin. You'll either see
that the identity columns are handled properly or you won't. If you
do, we both get a gold star. And if you don't, then we can talk about
it a little more and see what happens. Godspeed! :)
--
Ben