Manage Learn to apply best practices and optimize your operations.

Creating replica stubs

Creating replica stubs is a good way to distribute small files via your mail system. Here's how to do it.

Creating replica stubs is a good way to distribute small files via your mail system.

For example: A company directory that is 100 MB needs to be distributed to a widespread sales force, many of whom are using dial-up access. They need the files on their machines so that information can be accessed from anywhere without going online. If you try to send an entire database to people who are using dial-up to access their Notes servers, it will take them hours to get a single mail message.

If you send a replica stub, which is 100 KB, they get the message very quickly, download the replica stub to their hard drives, and start replicating in minutes. The replication may take hours, but it can be done in the background without freezing users' machines. As the replication continues, they will have partial data until it is completed, but can still use their machines while the data transfer is continuing.

Use this agent to create as many replica stubs as you want. Just set your naming convention and the number, and your stubs are created.

Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase 
'original database
Dim dbr As NotesDatabase 
'new replica stub
Dim nr As NotesReplication 
'original replication info
Dim nrr As NotesReplication 
'replica db replication info

Set db = s.CurrentDatabase
Set nr = db.ReplicationInfo 
'get source replication settings
nr.Disabled = True 'temporarily 
turn off replication
nr.Save 'save replication settings

For i% = 1 To 10 'filename attempt
'new replicas will be i% + original db name
'set your own naming conventions here
'CAUTION - delete previous databases 
with same filename
'allows for debugging runs - 
probably get rid of in production
Set dbr = New NotesDatabase("", Cstr(i%) &
If dbr.IsOpen Then 
End If

' now create the replica - since replication 
is disabled, you just get a stub
Set dbr = db.CreateReplica("", Cstr(i%)
& db.FileName)

'now turn on replication for new replica stub
Set nrr = dbr.ReplicationInfo
nrr.Disabled = False

'turn back on replication for the original
nr.Disabled = False
End Sub

Do you have comments on this tip? Let us know.

This tip was submitted to the tip library by member Don Bechtold. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Dig Deeper on Lotus Notes Domino Agents



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury