我在Domino Server(版本8.5)上有许多数据库,我需要找到它们的数量:
有没有简单的方法让Domino Server 8.5显示它?
非常感谢 克里斯
答案 0 :(得分:3)
您可以通过在某个域的服务器上启用域目录任务来获取每个NSF的文档数。这将创建一个域目录数据库(catalog.nsf),其中包含域中所有数据库的信息。然后,您可以在该数据库中创建自定义视图,以按整个文档等组织数据库。
不幸的是,编目过程不会跟踪每个视图中有多少文档。此外,无法保证每个数据库都具有“所有文档”视图。该视图是许多数据库设计模板(如Mail或Discussions)的一部分,但它实际上只是一个设计元素,而不是每个笔记数据库的基础。
以下是您可以运行的一些代码,用于在给定服务器上为您获取该信息。注意,这段代码很慢。
Sub CountDocuments()
'Handle database not open error
On Error Goto ProcessError
On Error 4060 Goto ProcessNotOpenError
On Error 4063 Goto ProcessNotOpenError
On Error 4185 Goto ProcessNotOpenError
'Constants
Const SERVERNAME = "SERVER/DOMAIN"
Const FILENAME = "C:\database_entry_counts.csv"
'Initialize Objects
Dim s As New Notessession
Dim db As Notesdatabase
Dim dbDirectory As NotesDbDirectory
Dim docCollection As NotesDocumentCollection
Dim doc As NotesDocument
Dim strRow As String
Dim numDocs As Long, numAllDocs As Long
Dim viewAllDocs As NotesView
Dim vecAllDocs As NotesViewEntryCollection
Dim ve As NotesViewEntry
Dim docCount As Long
'Get Database Directory
Set dbDirectory = s.GetDbDirectory(SERVERNAME)
Set db = dbDirectory.GetFirstDatabase(DATABASE)
flag = db.Open( "", "" )
While flag = False 'Get next database if first can't be opened
Set db = dbDirectory.GetNextDatabase
flag = db.Open( "", "" )
Wend
'Open output file
Set stream = s.CreateStream
If Not stream.Open(FILENAME, "ASCII") Then
Messagebox FILENAME,, "Open failed"
Exit Sub
End If
If stream.Bytes <> 0 Then
Messagebox FILENAME,, "File already exists and has content"
Exit Sub
End If
'Output headers
Call stream.WriteText(|"Database Name","Total Documents","Count of All Documents"|, EOL_CRLF)
'Main Loop
While Not (db Is Nothing)
Print "Working on: " & db.Title
docCount = 0
strRow = ""
'Get number of documents in database (easy)
numDocs = db.AllDocuments.Count
'Get number of documents in view (annoyingly difficult)
Set viewAllDocs = db.GetView("($All)")
If Not (viewAllDocs Is Nothing) Then
Set vecAllDocs = viewAllDocs.AllEntries
Set ve = vecAllDocs.GetFirstEntry
While Not (ve Is Nothing)
If ve.IsDocument Then docCount = docCount + 1
Set ve = vecAllDocs.GetNextEntry(ve)
Wend
Else
docCount = 0
End If
'Output values to our comma delimited list
strRow = |"| & db.Title & |","| & numDocs & |","| & docCount & |"|
Call stream.WriteText(strRow, EOL_CRLF)
'Get next database that can be opened
Set db = dbDirectory.GetNextDatabase
If Not (db Is Nothing) Then flag = db.Open( "", "" )
While flag = False
Set db = dbDirectory.GetNextDatabase
If Not (db Is Nothing) Then flag = db.Open( "", "" )
Wend
Wend
'Close file
Call stream.Close
Exit Sub
ProcessNotOpenError:
Resume Next
ProcessError:
Messagebox "Error " & Err() & ": " & Error()
If Not stream Is Nothing Then
stream.Close
End If
Exit Sub
End Sub
如果您使用可访问服务器上所有数据库的帐户运行此文件,则会输出包含数据库名称和您要查找的计数的CSV文件。
答案 1 :(得分:0)
我会在服务器上创建自己的“MyStats.nsf”数据库。此db将包含每n小时触发的LotusScript代理“UpdateAll”。
代理程序基本上获取数据库路径列表。对于每个路径打开数据库。 NotesDatabase.AllDocuments.Count为您提供文档总数。打开视图“($ All)”并检索nr的NotesView.AllEntries.Count。的文档。为“所有文件”。获取此信息并创建新的NotesDocument以保存数据库名称和检索到的数字信息。最后但并非最不重要的是在MyStat中创建一个视图来显示结果。