As stated, I’m trying to find some way to automatically rebuild a replica database on some kind a schedule. As it is, the best thing I can come up with is manually rebuilding the replica by manipulating the “Remove documents not modified in the last xx days” setting.
The problem is that I am replicating based on folders. So if a document is removed from the folder on the prime server, the document simply stops replicating. And instead of being removed from the replica, it ends up just sitting there. So if there is some other way to programatically remove a document from a replica, that would probably work, too. Any suggestions would be appreciated.
Subject: ISO automated way to rebuild replica
The only way to remove a document from a replica is to delete it.
That can be done manually, via an agent, or by replicating with another copy of the database where the document was deleted, and left a deletion stub.
I’d suggest you run a scheduled agent on your replica that synchronizes your copy with the Master. The following presumes you will not be creating new documents in your replica.
Compare the documents in the two folders
If there’s a document in your folder that’s not in the main database’s folder, delete it.
Use the RemovedPermanently method so that this will not be a soft delete
ENSURE THAT YOUR REPLICA DOES NOT SEND DELETIONS BACK TO THE MASTER !!!
I thought there’s was a method to remove a document and not leave a deleted stub behind, but I cannot find that right now in the help. That would be the preferred method over a normal delete.
Update : Thanks Stan - It was in the API. See response after this for a link to an example.
If you can create new documents, you need to add some code to check if the document exists in the other database (but not in the folder) and removed if only if it’s in both DB’s.
Subject: RE: ISO automated way to rebuild replica
Take a look at Julian Robichaux’s site for LS code that calls a C API method for stubless deletion.