Lotus Notes FAQ Visit Our Sponsor!

How do you get a list of inactive databases?

From Thomas Kennedy:

If you look in the server log there is a view called "Usage by Database" with Activity documents. There is one Activity doc per app on the server. In the activity doc there is a rich text field called "AllViewInfo"; this field stores the view names and the size of the view index, like this:

view1 tab number newline
view2 tab number newline

and so on. If you extract this information to another database, and there extract the text of the rich text field, and split it into an array based on newline, and then split each element of this array based on tab, you will have the name of each view and the size of the index.

Because Notes discards the view index after 45 days of disuses, this gives you a very simple and more or less accurate way of identifying unused apps. If, for example, 95% of the views have a size of zero you can flag that app for a closer look.

The rich text data is not perfectly consistent, so the call to split() should be in an error trap.

Sample code:

' **********************************************************
' Split the item's data into an array based on Newline.
' This gives us an array whose values are like:
'
' {viewname tab number; viewname tab number}
' **********************************************************
v1 = Split(activity_richtext.GetUnFormattedText, Chr$(13)&Chr$(10), -1,5)

total_views = 0
total_populated_views = 0

' **********************************************************
' Split each element of that array based on tab. This 
' gives us an array whose values are like:
' {viewname;number}
' **********************************************************
For c = 0 To Ubound(v1)
  v2 = Split(v1(c), Chr$(9), -1,5) 

  ' **********************************************************
  ' Some documents will contain "No views" or something
  ' similar in their rich text item. The resulting ubound will
  ' be 0, not 1. We step over these. The marker will be
  ' ACTIVITY_MARKER_UNKNOWN.
  ' **********************************************************
  If Ubound(v2) < 1 Then Goto NextView

  ' **********************************************************
  ' We keep track of two numbers: the number of views,
  ' and the number of non-zero view sizes. These tell us
  ' what percentage of the views have an index, and thus
  ' indirectly whether the db is in use or not.
  ' **********************************************************
  total_views = total_views + 1 

  ' **********************************************************
  ' Inconsistencies in the way the data is stored may
  ' result in a value that we cannot convert to a number,
  ' so this cast may raise an exception.
  ' **********************************************************
  On Error Resume Next
  tmp_double = Cdbl( v2(1) )
  On Error Goto 0

  ' **********************************************************
  ' If it does we just skip to the next view.
  ' **********************************************************
  If Err <> 0 Then
    Err = 0
    Goto NextView
  End If

  If tmp_double > 0 Then
    total_populated_views = total_populated_views+1
  End If

nextView:
Next c 



Applies to Notes Versions: 6 6.5 7
Last Modified: January 31, 2007