This following code was tested in Lotus Domino Server R6. Once you embed it in a button or agent, clicking/running this script will generate a Microsoft Excel comparison report, including actual mail file size, quota, and warning threshold for the replicas residing on the source and destination servers in a Lotus Domino server cluster.
The Microsoft Excel report that is generated can be used to study mismatches, which could be caused by lack of replication between the databases in the two Lotus Domino servers being compared in the cluster.
Clicking on the button or running the agent containing the following code will:
- Prompt you to enter the first server of the cluster.
- Prompt you to enter another server in the cluster that you wish to check.
- Prompt you to enter the folder (mail for mail files) of the first/source server to be checked.
- Generate the report in Microsoft Excel, which can then be used to study the mismatches in the replica size, etc.
On Error Resume Next
Dim session As New notessession
Dim Sdbdirectory As NotesDbDirectory
Dim Sdb As NotesDatabase
Dim Sfilepath As String
Dim Ddbdirectory As NotesDbDirectory
Dim Ddb As NotesDatabase
Dim SrcServ As String
Dim DestServ As String
Dim rows As Long
Dim maxcols As Integer
SrcServ=Inputbox$("Please enter the
Source Server","Tools","Source Server")
DestServ=Inputbox$("Please enter the
Destination Server","Tools","Destination server")
Sfilepath=Inputbox$("Please provide
the folder path on source which needs
to be checked e.g. mail or databases","Tools","mail")
'================================
================================
=============================
'================================
================================
======================================
'excel variable initialization
Set xlApp = CreateObject("Excel.Application")
'start Excel with OLE Automation
xlApp.StatusBar = "Creating WorkSheet.
Please be patient..."
xlApp.Visible = True
xlApp.Workbooks.Add
xlApp.ReferenceStyle = 2
Set xlsheet = xlApp.Workbooks(1).
Worksheets(1) 'select first worksheet
'=================================
=================================
===========================
'worksheet title
xlApp.StatusBar = "Creating Column
Heading. Please be patient..."
rows=2
xlsheet.cells(rows,4)=SrcServ
xlsheet.cells(rows,7)=DestServ
rows=3
xlsheet.Cells(rows,1).value="Database File "
xlsheet.Cells(rows,2).value="Title"
xlsheet.Cells(rows,3).value="Mail Size (MB)"
xlsheet.Cells(rows,4).value="Mail Quota (MB)"
xlsheet.Cells(rows,5).value="Warning Threshold (MB)"
xlsheet.Cells(rows,6).value="Mail Size (MB)"
xlsheet.Cells(rows,7).value="Mail Quota (MB)"
xlsheet.Cells(rows,8).value="Warning Threshold (MB)"
maxcols=8
rows=4
'===========================================
=============================================
Set Sdbdirectory=session.GetDbDirectory(SrcServ)
Set Ddbdirectory=session.GetDbDirectory(DestServ)
Set
Sdb=Sdbdirectory.GetFirstDatabase(DATABASE)
While Not Sdb Is Nothing
repid=Sdb.ReplicaID
tmpFilename=
Strleftback(Sdb.FilePath,"")
If tmpFilename=Sfilepath Then
Set Ddb=New notesdatabase("","")
flag = DDb.OpenByReplicaID(DestServ,repid)
If flag=True Then
xlsheet.Cells(rows,1).Value = Sdb.FileName
xlsheet.Cells(rows,2).Value ="'"+ Sdb.Title
xlsheet.Cells(rows,3).Value =(Sdb.size/1000000)
xlsheet.Cells(rows,4).Value =Sdb.SizeQuota/1024
xlsheet.Cells(rows,5).Value =sdb.SizeWarning/1024
xlsheet.Cells(rows,6).Value =(Ddb.size/1000000)
xlsheet.Cells(rows,7).Value =Ddb.SizeQuota/1024
xlsheet.Cells(rows,8).Value =Ddb.SizeWarning/1024
xlApp.StatusBar = "Importing Notes Data - Document " & rows-1
Set DDb=Nothing
Else
xlsheet.Cells(rows,1).Value = Sdb.FileName
xlsheet.Cells(rows,2).Value ="'"+ Sdb.Title
xlsheet.Cells(rows,3).Value =(Sdb.size/1000000)
xlsheet.Cells(rows,4).Value =Sdb.SizeQuota/1024
xlsheet.Cells(rows,5).Value =sdb.SizeWarning/1024
xlsheet.Cells(rows,6).Value ="Missing on destination server"
xlApp.StatusBar = "Importing Notes Data - Document " & rows-1
End If
rows=rows+1
End If
Set
Sdb=Sdbdirectory.GetNextDatabase()
Wend
xlApp.Rows("1:1").Select
xlApp.Selection.Font.Bold = True
xlApp.Selection.Font.Underline = True
xlApp.Range(xlsheet.Cells(2,1),
xlsheet.Cells(rows,maxcols)).Select
xlApp.Selection.Font.Name = "Arial"
xlApp.Selection.Font.Size = 9
xlApp.Selection.Columns.AutoFit
With xlApp.Worksheets(1)
.PageSetup.Orientation = 2
.PageSetup.centerheader = "Report - Confidential"
.Pagesetup.RightFooter = "Page &P" & Chr$(13) & "Date: &D"
Pagesetup.CenterFooter = ""
End With
xlApp.ReferenceStyle = 1
xlApp.Range("A1").Select
xlApp.StatusBar = "Importing Data from
Lotus Notes Application was Completed."
Set xlapp=Nothing 'stop OLE
Set db=Nothing
Do you have comments on this tip? Let us know.
Related information from SearchDomino.com:
Tip: A primer on Lotus Domino clustering
Tip: Monitoring Lotus Domino cluster replication
Tip: Locate missing databases in a Lotus Domino cluster
Tip: Lotus Domino cluster tuning
This tip was submitted to the SearchDomino.com tip library by member Blessan V. Philip 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.