Search code examples
sql-serversql-server-2008-r2merge-replication

Preserver Filegroup on Subscriber in Merge Replication SQL Server 2008R2


How do you preserve the File Group on the Subscriber of a Merge Replication Publication? I created identical databases with 3 filegroups for various groups of tables, assigned to the appropriate filegroups when the tables were created.

The first time I created a publication (populated publishing database first, data went into correct filegroups) the tables on the subscriber were all dropped and recreated in the default filegroup of the subscriber.

OK, so I changed the "Action if name is in use" property to Truncate data in destination tables on initialization: snapshot ran fine, subscriber sync failed because it said it could not execute the script to add the rowguid column to the tables.

So what is the best way to keep the filegroups from changing? I want the data to go into the desired file groups when it is pushed by the publisher to the subscriber.


Solution

  • After yet more research, it turns out there is a flag in the the Article Properties called "Copy file group associations" which is set to FALSE by default.

    It wouldn't let me just change it, had to rebuild the publication, but doing so and setting the FLAG to true recreated the tables with the desired Filegroups on the subscription databases and after snapshot creation, the subscriptions pushed and the data flowed into the correct filegroups. Sweet!