Groups | Blog | Home
all groups > sql server replication > may 2007 >

sql server replication : Snapshot replication


cata
5/16/2007 6:45:00 AM
I have a snapshot replication that runs over the night and it takes about 1
hr. The issue that I have is that is locking people out of the system until
the snapshot finish.

Is there a way to eliminate this or do I have to look for other ways to
replicate the data? Would decreasing the -BcpBatchSize alleviate the issue or
Paul Ibison
5/16/2007 9:17:02 AM
You can look at @sync_method='concurrent' or 'database snapshot' to minimise
the locking when running sp_addpublication.
HTH,
Paul Ibison
Raymond Mak [MSFT]
5/16/2007 9:43:46 AM
Are you mostly concerned with the publisher database being locked out or the
subscriber database?

[quoted text, click to view]

cata
5/16/2007 10:54:01 AM
I am concern with the publisher getting locked when the snapshot is
generated, the publisher is a production database.

[quoted text, click to view]
Raymond Mak [MSFT]
5/16/2007 11:05:08 AM
Like Paul mentioned in his reponse, you can set sync_method to 'database
snapshot' if you are running SQL2005 SP2 EE at your publisher. Note that if
this is really a straight snapshot publication, you can't set the
sync_method to 'concurrent' as that requires that logreader agent for
tracking the reconciliation commands.

-Raymond

[quoted text, click to view]

cata
5/16/2007 11:50:00 AM
Unfortunatelly the publisher is SQL Server 2k and the subscriber is a SQL
Server 2k5.

[quoted text, click to view]
cata
5/16/2007 11:53:01 AM
From what I can see the sync_method is only available for transactional and
merge replication but not for snapshot replication

http://msdn2.microsoft.com/en-us/library/aa239409(SQL.80).aspx


[quoted text, click to view]
cata
5/16/2007 12:55:00 PM
What about -BcpBatchSize, would it bring any value reducing the size of it?

[quoted text, click to view]
Paul Ibison
5/16/2007 8:43:52 PM
Like Raymond says, the 'database snapshot' option applies to SQL 2005
publishers. As you have a 2000 publisher, this is not an option. You'll have
to run the snapshot agent out of hours, or use an alternative mechanism. One
possibility I would consider is to use log shipping. The standby server can
be used as a source of data for the subscriber if you like. This wouldn't be
via replication, but you could use DTS for it. This way there'll be no
locking issues at all on the publisher.
Cheers,
Paul Ibison

Raymond Mak [MSFT]
5/17/2007 9:56:43 AM
Changing -BcpBatchSize will not do any good. You can set -MaxBcpThreads to a
higher value in an attempt to increase throughput but I am guessing you have
probably tried that already.

-Raymond

[quoted text, click to view]

cata
5/17/2007 10:37:01 AM
Yes, I am at -MaxBcpThreads 9, from there up I haven't noticed any benefit.
For
-BcpBatchSize I start decreasing the batch size from 100000 to now at 10000
with no noticeable processing time difference in the hope that decreasing the
size will give users a chance to do some work between batches. I will keep
going down untill there would be a jump in the time the process take to
finish.

[quoted text, click to view]
Frivas
5/17/2007 2:51:00 PM
Check under the publication options on the snapshot tab, there is an option
for do not lock tables during snapshot generation.

Hope this helps

cata
5/18/2007 5:48:01 AM
Couldn't find it. Is this for Snapshot Replication or Transactional
Replication?

[quoted text, click to view]
Raymond Mak [MSFT]
5/18/2007 9:34:25 AM
The "do not lock table" option in the UI actually corresponds to sync_method
= 'concurrent' so it is not available to straight snapshot publications. The
labelling of the option is also a bit mislead as I have explained in the
following post:

http://groups.google.com/group/microsoft.public.sqlserver.replication/browse_frm/thread/415c42838fbef3f5/9574613bd887acd5?rnum=22#9574613bd887acd5

If you don't mind the potential for (slightly) inconsistent data at your
subscriber, Paul's suggestion of using DTS is definitely the way to go. That
said, we do have a lot of improvements in SQL2005 targetting your particular
scenario such as the 'database snapshot' sync_method and article bcp
partitioning for increasing snapshot generation throughput if your
publication has a few very large tables.

-Raymond
[quoted text, click to view]

cata
5/22/2007 6:15:01 AM
Thanks for your help guys.

[quoted text, click to view]
AddThis Social Bookmark Button