Manage Learn to apply best practices and optimize your operations.

Fast & easy mass replication

Here's how to quickly replicate with a minimum of hassle.

Replicating can be a pain when you have numerous databases, even when you have a good Admin tool to help you. A little bit of coding made the task a lot easier for me and saved me dozens of hours of work when doing server infrastructure changes. This tool involves creating a database with the following parts:

Form: Database Replicate-by Filename. This form has the following fields:

  • Database Replication by File List Name: [ReplicateListName]
  • Comments: [ReplicateListComments]
  • Server to Replicate from: [FromServer]
  • Server to Replicate to: [ToServer]
  • Path to replicate to: [ToPath]
    (Leave this blank if you want the files to go to the same path as the original)
  • Enter List of Databases: (include path, i.e. mailamable.nsf)
    (Note: This will replicate to the same path on the new server.)
  • [ReplicateList]

This form also contains a button to run the Database Replicate-by Filename agent. This form is used to create replication lists for the various different replication profiles you may want to setup. You can use them for one time shots then delete them, or save a profile that you may use on a regular basis.

View: Database MaintDatabase Replicate-by Filename. (Note: I use a nested view because I have numerous utilities in this database and this helps me sort them out.) This view shows the following columns to display the following fields:

  • List Name: [ReplicateListName]
  • Replicate from: [FromServer]
  • Replicate to: [ToServer]

This view also contains a button to open the Database Replicate-by Filename form. It is used to display the profiles created using the Database Replicate-by Filename form.

Agent: Database Replicate-by Filename (see included code)

When should agent run?: On Schedule Never

This agent creates and populates a new replica on the receiving server. If you have included a value in the [ToPath] field it will choose that new path to replicate the databases to on the receiving server. If the [ToPath] field is blank, it will replicate the databases to the same path as found on the original server.

With minor modifications, you can setup the agent to run on the server instead of your workstation (as long as the server it is running on has the right to access the database on the 'from' server and create new replicas on the recieving server. I prefer running this utility on an Administrative workstation rather than a server, just for the visibility it gives me into the progress of replication.

Sub Initialize
	Dim workspace As New notesuiworkspace
	Dim uidoc As notesuidocument
	Dim listdoc As notesdocument
	Dim db As notesdatabase
	Dim db2 As notesdatabase
	Dim db3 As notesdatabase
	Dim toserver As Variant
	Dim fromserver As Variant
	Set uidoc=workspace.currentdocument
	Set listdoc=uidoc.document
	Forall filename In listdoc.ReplicateList
		Set db = New notesdatabase (fromserver,filename)
		If Not db.IsOpen Then Call db.Open (fromserver,filename)
		If Not db.IsOpen Then 'cannot open file
			Exit Sub
		End If
		If topath<>"" Then  'database(s) to replicate to a different folder
			If Right(topath,1)<>Chr$(92) Then topath=topath+""
			For n=Len(filename) To 1 Step -1
				If Mid(filename,n,1)=Chr$(92) Then 'found beginning of path, replace with topath
					Exit For
				End If
		End If
		Set db3 = New notesdatabase (toserver,filename) 'ensures there is not already a file of that name
		If Not db3.IsOpen Then
			Set db2 = db.CreateReplica(toserver,filename)
			Call db.replicate(toserver)
		End If
	End Forall
End Sub

Dig Deeper on Domino Resources - Part 6

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...