HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Snapshot for transactional replication taking too long for large database

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
transactionallongtooreplicationdatabasesnapshotlargefortaking

Problem

I want to establish a transaction replication of a large database (200GB). But when I create the publisher and the snapshot agent starts, it takes very very long time and it sticks on the following message


The process is running and is waiting for a
response from the server

but the problem is when I see the size of the snapshot folder, I can see it is growing up! But too slowly.

Do you have any Idea about this? or any different way of doing the replication? how can I find the more detailed warning or errors messages?

P.S. In my database there are two tables for Images that they make 98% of the size of my database. when I don't include them in my publication, everything goes fine. but when I Include them, I will face the problem.

Solution

Yes, initializing a large database through a snapshot can be very slow and time consuming. If it is appropriate to your case, you should start by restoring a copy of the database to the target machine.

In setting up the subscription choose "allow initialization from backup files".

Because of limitations in the user interface for setting up replication, you will need to create a script instead of relying on the UI tools. There is a blog post on this at:

Link

The post from msdn includes the code sample:

exec sp_addsubscription @publication = N'Repl2000', …..
    @sync_type = N'initialize with backup', @backupdevicetype='Disk',
    @backupdevicename='C:\Repl2000_RestoreThis.bak'--the last backup used to restore on the subscriber 
go
exec sp_addpushsubscription_agent …….
go


The article also includes some troubleshooting tips.

Code Snippets

exec sp_addsubscription @publication = N'Repl2000', …..
    @sync_type = N'initialize with backup', @backupdevicetype='Disk',
    @backupdevicename='C:\Repl2000_RestoreThis.bak'--the last backup used to restore on the subscriber 
go
exec sp_addpushsubscription_agent …….
go

Context

StackExchange Database Administrators Q#50698, answer score: 5

Revisions (0)

No revisions yet.