Help restoring a replicated database

Hi Everyone,

I’m sure this is a basic task, but I’ve recently been thrown in to the role of “Notes Administrator” and know very little so far.

I have a database that is replicated to all my Notes servers (50). Some documents have been deleted from it, which has, of course, been replicated everywhere. I have restored a good copy of the database from tape, but every time I try to replace it, all the docs just get deleted again, presumably because it replicates with the rest of the sites.

How can I restore a file and tell Domino that it should treat it as the authoritative file and send the current copy out?

Thanks in advance.

Subject: Help restoring a replicated database

How many documents are you referring to? Would it be necessary for them to actually be the SAME document that they used to be…such as the same UNID?

Subject: RE: Help restoring a replicated database

We’re talking about approximately 650 documents … so opening and saving each one is not very practical, although if that’s what I have to do …

Or is there a way for me to open and save every doc in the database at once?

What about removing the deletion stubs? Is that possible?

Subject: RE: Help restoring a replicated database

You could write an agent that saved each selected doc in a view pretty easily. Something like (untested) …

Sub Initialize

Dim workspace As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim collection As NotesDocumentCollection

Set collection = db.UnprocessedDocuments

Dim isAdmin As Variant

isAdmin = Evaluate(|@IsMember(“[Administration]”; @UserRoles)|)

If isAdmin(0) = False Then

  Messagebox "You do not have sufficient access to use this Action.", 64, "Access Restriction"

  Exit Sub

End If

’ Wake up user.

answer% = Messagebox (“Do you really want to save all the selected documents?” + Chr(13) + “This will update the last modified date.”, 4+32+256, “Document Processing”)

If answer% = 7 Then

  Exit Sub

End If

If collection.Count = 0 Then

  answer% = Messagebox ("You must have at least one document seleted to use this action.", 0+48+0, "Document Processing")

  If answer% = 1 Then

     Exit Sub

  End If

End If

’ Set up document processing.

SuccessCounter% = 0

FailCounter% = 0

On Error Goto Errhandle

Dim doc As NotesDocument

For counter = 1 To collection.Count

Set doc = collection.GetNthDocument( counter )

If doc.Save( True, False ) Then

  SuccessCounter% = SuccessCounter% + 1

Else

  FailCounter% = FailCounter% + 1

End If

Print "Replace Values Progress: Item " + Cstr( counter ) + " of " + Cstr(collection.Count)

Next

’ Process complete.

Call workspace.ViewRefresh

Messagebox “Processed " + Cstr(SuccessCounter%) + " document(s) successfully.” + Chr(13) + Cstr(FailCounter%) + " document(s) failed.", 0+64+0, “Document Processing”

Exit Sub

Errhandle:

’ Use the Err function to return the error number and the Error$ function to return the error message.

FailCounter% = FailCounter% + 1

answer% = Messagebox (“Item " + Cstr(counter) + " failed. Error” & Str(Err) & ": " & Error$, 0+48+0, “Document Processing”)

If answer% = 1 Then

  Exit Sub

End If

Resume Next

End Sub

Subject: RE: Help restoring a replicated database

Ok I’ve looked into this a bit further and unfortunately, I don’t think that solution is going to work. The problem is if I open and save the docs, I become the author. This particular database is often navigated by Author, and that would cause some problems for the users. So that’s not an option.

I did some digging and here’s what I’ve come up with. It appears that I can get rid of the deletion stubs by setting “Remove Documents not modified in the last # days” to 0 under Space Savers in the replication settings on each server, and then opening the database. This I have done on all servers, so the deletion stubs SHOULD be gone. Now we had thought we’d done this already - but it’s possible one may have been missed.

Next I’m going to temporarily disable replication for the database on each server (Replication Settings → Other → Temporarily disable replication for this replica).

Next, I will replace the database with the restored copy on the local server. Then, following the replication topology, I will one by one re-enable the replication on the database for that server and see what happens.

If anyone has any more suggestions, please fire them off. I’m way in over my head on this one. My previous Notes experience is very limited.

Subject: Further… to be validated.

Hi

We sometimes experience the same problem here.

You have to some other options.

1st, set your master server document connection document for replication for pushing only,

2nd as you said, disable the ‘delete documents’ in the replication settings (sometimes, the settings may be overridden)

You may also scan every document, store the $UpdatedBy property in some other field, and then save it.

Finally, another solution would be to change the unid of the doc (only if there are no doclinks DB to DB) :

dim n%, unid$

dim doc as NotesDocument

dim doc2 as NotesDocument

dim vdoc as NotesDocument

dim collec as NotesDocumentCollection

'HERE SET YOUR COLLEC TO THE UNPROCESSED DOCUMENTS

…

set doc=collec.getFirstDocument

while not doc is nothing

set doc2=collec.getNextDocument(doc)

unid$=doc.UniversalID

n%=val(“&H” & right$(unid$,2)) +1

right$(unid$, 2)=right$(Hex$(n%),2)

set vdoc=doc

while not vdoc is Nothing

 n%=val("&H" & right$(unid$,2)) +1

 mid$(unid$,31,2)=right$(Hex$(n%),2)

 set vdoc=database.getDocumentByUNID(unid$)

wend

doc.UniversalID=unid$

call doc.save(true, false)

call doc.remove(true)

set doc=doc2

wend

This will create a new document for every selected document, so the unid will be different, and no longer deleted

(I believe…)

Please, can some guru validate this ?

–Ian–>

Subject: RE: Help restoring a replicated database

What do you mean here that you become the ‘author’? Is Author a calculated field in your form? An AUTHORS Read-Access field?

You can’t stop yourself being the last editor, buy you can stick anything you want in that field during the script I supplied just before the save command.

Also did you TRY this? If your Author field is calculated it will NOT change from my script like it does in the client, as I do not call COMPUTEWITHFORM anywhere.

Subject: Help restoring a replicated database

I think if you edit and save each document they will stay.

When you delete a document it leaves an invisible ‘delete stub’ behind. Say a user goes on vacation an has a replica of your database on their laptop. You delete some docs and that replicates out. When they return and replicate you want your delete to remove their old versions. That is whats happening here.

However, if you edit the document, the new version no longer matches the delete stub and it will not be removed. Instead the new edited version should propagate to the other databases.

Subject: Help restoring a replicated database

Well as an update, I’m still fighting this. I’m not sure what’s going on anymore. I’ve disabled replication on every single one of the server for this database, and somehow every time I replace it, the deletions almost instantly get replicated.

Scripts scare me a bit because I really don’t know what I’m doing. The second one posted makes me even more nervous because it looks like it’s going to create a new copy of each document and then delete the old one. Great idea, as long as the copy works … if it doesn’t, I’m stuck with an empty database.

Lets say I wanted to just give up and blow away the copy on each server, and replicate the restored one back out. How would I do that?

Subject: RE: Help restoring a replicated database

Follow these steps. They have worked for me in the past.

1> Restore your DB from tape to a server that is not running Domino.

2> Copy the DB locally to your laptop/workstation and open it locally.

3> Select the documents in question, then copy them to the clipboard.

4> Open the server based copy of the DB and paste in the documents.

HTH,

Shawn

Subject: RE: Help restoring a replicated database

Thanks for everyones help. I wound up just deleting all replicas of the database, restoring it, and replicating it back out. It took a couple hours but in the end it worked.

Because the documents in the forum are author-sensative, re-saving or pasting in the missing documents was not an option.