Manage Learn to apply best practices and optimize your operations.

DBmedic Replicate, Reindex and Compact a selected database

This tip describes using DBmedic to Replicate, Reindex and Compact a selected database.

A facility you can add to your Welcome pages or in an action button. This option will list all database's (alphabetically) on the PC and give the option to Replicate, Reindex or Compact (or a combination of the three). It mainly benefits our support team who spend hours talking customers through these procedures which often solve many of the problems.

 (Declarations) Dim delta As Long Dim currdb As notesdatabase Dim getdb As Integer Dim dbbox As NotesDocument Dim TrimDB As String Dim db As notesdatabase Dim dbnames (100) As String Dim counter As Integer Dim uidoc As NotesUIDocument Dim NewList As String Dim doc As NotesDocument Dim k As Integer Dim i As Integer Dim j As Integer Dim h As Integer Dim r As Integer Dim DBArray() As String Dim temp As String Dim SubDB As String Sub Click(Source As Button) Dim dbdir As New notesdbdirectory("") Set ws = New NotesUIWorkspace Set uidoc=ws.CurrentDocument Set db = dbdir.getfirstdatabase(Database) counter = 0 While Not(db Is Nothing) counter = counter + 1 dbnames(counter) = db.title & " | " & db.FilePath Set db = dbdir.getnextdatabase Wend Call SortDbList DBType$=ws.Prompt(PROMPT_OKCANCELLIST ,"Select","Select a database to Reindex,
Compact or Replicate." + Chr(10) + "(Please be sure you are not currently active in your selected database)","None", DBArray) PositionOfBar& = Instr(1, DBType$, "|") + 2 SubDB=Mid$(DBType$, PositionOfBar&,100) Dim Choices(4) As String Choices(0)="Replicate - Compact - Reindex" Choices(1)="Compact - Reindex - Replicate" Choices(2)="Replicate" Choices(3)="Compact" Choices(4)="Reindex" DBType$=ws.Prompt(PROMPT_OKCANCELLIST ,"Select","Select an action","None",Choices) If DBType$ = "Replicate - Compact - Reindex" Then Call RepDB Call CompactDB Call ReindexDB Else If DBType$ = "Compact - Reindex - Replicate" Then Call CompactDB Call ReindexDB Call RepDB Else If DBType$ = "Compact" Then Call CompactDB Else If DBType$ = "Reindex" Then Call ReindexDB If DBType$ = "Replicate" Then Call RepDB Else Exit Sub End If End If End If End If End If End Sub Sub SortDBList For k = 0 To counter Redim Preserve DBArray(1 To k+1) DBArray(k+1) = Cstr(dbnames(k)) Next h = 1 Do While h < k h = (h*3)+1 Loop h = (h-1)/3 If h > 3 Then h = (h-1)/3 End If Do While h > 0 For i = 1+h To k temp = DBArray(i) j = i-h Do While j >0 If DBArray(j)>temp Then DBArray(j+h) = DBArray(j) DBArray(j) = temp Else Exit Do End If j = j-h Loop Next i h = (h-1)/3 Loop End Sub Sub CompactDB Dim db As New NotesDatabase( "", SubDB) 'Compacting Print "Compacting " & SubDB & "...." Call db.Compact Msgbox "Compact of database " & SubDB & " complete" End Sub Sub ReindexDB Dim db As New NotesDatabase( "", SubDB) 'Reindex Forall vv In db.Views Print "Reindexing " & SubDB & "...." Call vv.Refresh End Forall Msgbox "Reindex of database " & SubDB & " complete" End Sub Sub RepDB Dim db As New NotesDatabase( "", SubDB) Dim s As New notessession 'Determine server to replicate to server$ = s.getenvironmentstring("MailServer",True) 'Replicate Print "Replicating " & SubDB & " with server$ ...." Call db.Replicate(server$) Msgbox "Database " & SubDB & " replicated with " & server$ End Sub

Dig Deeper on Domino Resources - Part 3

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 ...