IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

Theo Heselmans complains about profile documents that get overwritten when users create local replicas. He describes the process by which this occurs:

- Replicate a db with a dbprofile doc
- Interrupt the replication, so the db is not yet fully initialized (some users do this)
- Open the replica: the db postopen script sees there is no dbprofile yet, and creates a blank one.
- if the user then continues with the replication, the 'main' dbprofile is overwritten, loosing all data.
I ended up with creating a backup and restore procedure for the profile docs.

This is actually something I described in one of my comments. The profile document does not get overwritten. The above set of steps results in the creation of a new profile document in the local replica, which then replicates to the server. Rather than backup and restore, the solution is to delete the new, blank profile, so that the old one is found again when someone tries to read a profile field.

Better yet, prevent the problem from occurring in the first place. Before the user has a chance to try to reference the missing profile, check that it exists and if it doesn't, kick them out. This code in the database script should do the trick:

Sub Postopen(Source As Notesuidatabase)
   Dim db As NotesDatabase
   Set db = Source.Database
   Dim collProfiles As NotesDocumentCollection
   Set collProfiles = db.GetProfileDocCollection("MasterProfile")
   If collProfiles.Count = 0 Then
      Msgbox "Please finish replicating this database before you open it. The profile document is missing.", 16, "Oops!"
      Source.Close
   End If
End Sub

Andre Guirard | 16 August 2007 01:00:00 PM ET | Café Porch, Plymouth, MN, USA | Comments (2)


 Comments

1) What a Relief
Bruce Langner | 8/16/2007 7:12:24 PM

This is a problem that has been bugging me for so long. Many thanks, although I have now moved to another job and it's no longer my problem, I have sent the guys a link to this entry. The other thing that I had never seen before was a db profile rep save conflict. That one caused some serious problems in a db.search document collection.

2) Great Tip !
Theo Heselmans | 8/17/2007 3:43:43 AM

You are correct that the local replica creates a new dbprofile doc (because of db.GetProfileDocument), but during replication, that new dbprofile document overwrites the one in the 'main' db.

I'm very happy with the db.GetProfileDocCollection tip though! This is indeed a solution I never thought of.

I'm about to implement it at a customer I'm currently working at.

 Add a Comment
Subject:
   
Name:
Comment:  (No HTML - Links will be converted if prefixed http://)
 
Remember Me?     Cancel

Search this blog 

Disclaimer 

    About IBM Privacy Contact