I have two servers.
I have installed a merge replication in the publisher (Server A) and I have added two subscriptions with the same database name.
- One on the publisher itself and the seconde one on the subscriber (Server B).So far so good. The replication is working well.
I wanted to delete the subscibed database on the publisher (Server A) and replace it by a copy of subscribed database from Server B.
I thought the publisher will continue synchronizing on the newly attached database, but unfortunately, it didn't work as expected, it started aplying snapshot etc.. instead.
Is there anything to modify on the the copied database to make the publisher reconise it as the deleted one and continues synchronizing ?
All the meta-data that configures a database as a publisher is stored in the database its self. So deleting the database deletes the publication as well. Moving a database that was formerly a subscription and making it a publisher requires initializing the database and configuring it as a publisher the same way you would starting out from scratch.
There are a few tricks that could mimic what you are attempting to do however. Namely, backing up your subscription. Then deleting all the data from your publisher and syncing. Don't delete the publication, just the data in the database. The sync will merge the deletes to the subscriber as well but that's why you have a backup.
At that point you'd restore the subscription backup you took back onto the subscriber. Ensure that 'retain replication info' is set. Once restored sync again. The result should be that the original data from the subscription backup would be the only data to merge back to the publisher which was empty prior to the restore.
I have not personally tried in practice but in theory should work. Read here for more info on the in's and out's of backing up and restoring merge replication schemes.