Locate missing databases in a Lotus Domino cluster
SearchDomino.com Hall of Famer Blessan Philip explains how to generate a report in Microsoft Excel of all databases that are not present on the Lotus Domino servers in a selected cluster.
The following code – which I've tested it in Lotus Domino R6, embedded in a button generates a report in Microsoft Excel of all databases that are not present on Lotus Domino servers in a selected cluster.
- The code first prompts the user to enter the Lotus Domino server name where the cluster directory (cldbdir.nsf) resides.
- It then prompts to enter the number of servers in the cluster of which the entered server is a member
- Finally, it generates reports in Microsoft Excel of all databases that are not present on all the Lotus Domino servers of the selected cluster.
Details of the missing Domino databases generated contains database file path, title and the servers on which it is present.
Dim session As New notessession Dim db As NotesDatabase Dim doccoll As NotesDocumentCollection Dim Allview As NotesView Dim doc As NotesDocument Dim tempdoc As NotesDocument Dim xlApp As Variant, xlsheet As Variant, rows As Integer, cols As Integer Dim tempCol As Integer Dim serv_nm As String Dim db_nm As String Dim TempNumServOnClust As String Dim NumServOnClust As Integer Dim lst_repid List As String rows=1 cols=1 serv_nm=Inputbox("Provide the name of the server on which the Cluster directory resides. Blank entry would look for the cluster directory database on local ","Tools","ServerName") db_nm="cldbdir.nsf" TempNumServOnClust=Inputbox$ ("Number of member servers of the cluster ","Tools","2") If Not Isnumeric(TempNumServOnClust) Then Msgbox "Server count on the cluster should be numeric" Exit Sub Else NumServOnClust=Cint(TempNumServOnClust) End If 'Set db=session.CurrentDatabase Set db=New NotesDatabase(serv_nm,db_nm) If db Is Nothing Then Msgbox "Database could not be found on the server"+serv_nm Exit Sub End If Set Allview=db.getview("($ReplicaID)") '===================================== ===================================== ============================ '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 xlsheet.Cells(rows,cols).Value ="Following Databases are not available on all the " +Cstr(NumServOnClust)+" Servers , Database: " + db.title +", Export created on: " + Format(Now,"DD/MON/yyyy HH:MM") xlApp.StatusBar = "Creating Column Heading. Please be patient..." rows=2 xlsheet.Cells(rows,1).value="Database File" xlsheet.Cells(rows,2).value="Title" xlsheet.Cells(rows,3).value="Available on Servers" maxcols=NumServOnClust Set doc=allview.GetFirstDocument rows=3 While Not doc Is Nothing repid = Evaluate({@text(ReplicaID;"*")},doc) Set doccoll=allview.GetAllDocumentsByKey(repid(0)) flg=Iselement ( lst_repid( repid(0) ) ) xlApp.StatusBar = "Checking " & doc.title(0) If doccoll.count<NumServOnClust And flg=False Then xlsheet.Cells(rows,1).Value ="'"+ doc.GetItemValue("Pathname")(0) xlsheet.Cells(rows,2).Value ="'"+ doc.GetItemValue("Title")(0) '================================= ====================== Set tempdoc=doccoll.GetFirstDocument tempCol=3 While Not tempdoc Is Nothing xlsheet.Cells(rows,tempCol).Value ="'"+ tempdoc.GetItemValue("Server")(0) Set tempdoc=doccoll.GetNextDocument(tempdoc) tempCol=tempCol+1 Wend '=================================== ======================== xlApp.StatusBar = "Importing Notes Data - Document " & rows-1 rows=rows+1 End If lst_repid(repid(0))=repid(0) Set doc=allview.GetNextDocument(doc) 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:
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.