2012-09-25 195 views
0

我的用户很沮丧了,我们有一个大的Lotus Notes应用程序(而不是web)的糟糕表现提供了非常大的应用程序的迷你版。它目前是10Gb,大约有500.000个文件,它包含阅读器字段。我怎样才能到我的用户

我想要做的就是创建应用程序的迷你版,因为大多数用户仅在过去几年中的文件感兴趣。

大应用程序无法进行存档或在这个时候,所以我想提供一个新的小型副本移动,并做了选择性的复制,只包括这几年的文档。

我遇到的问题是,应用程序的完整版本需要在所有服务器上,这意味着我将在同一台服务器上获得完整版本和迷你版本,并使用相同的副本ID,这看起来有点可怕。

有没有更好的方式来做到这一点?

+2

你不能有两个数据库服务器上有相同的副本ID。如果你这样做,你会有一段糟糕的时光。 –

+0

西蒙是对的。不要这样做! –

+0

我知道,这就是为什么我问的问题 –

回答

3

我见过很多不同的方法解决这个问题,从简单到的方式过度设计。可悲的是,我认为我一直是过度设计方法的设计师。幸运的是,我学到了一些教训。这就是我认为是最低的高科技方法:你想要做的第一件事

是使数据库的唯一的设计副本。我将其称为productiondocs.ntf。我将把原作称为alldocs.nsf。

将两个代理添加到productiondocs.ntf,并确保它们受到设计刷新/替换的保护。将第一个代理调用为“synch”,并将其设置为在新文档或修改后的文档上运行,然后编写代码以将新/修改的文档简单复制到alldocs.nsf中。请务必检查isValid以防止处理此代理主循环中的已删除文档。呼叫第二个代理“清除”。编写代码检查日期(创建,修改或文档中的数据字段,取决于您要执行的规则)并删除超过一年的文档。现在

,您可以使用选择性复制 - 但只有一次。制作alldocs.nsf的选择性副本,仅包含一年的文档,并将其称为yeardocs.nsf。然后制作yeardocs.nsf的非副本副本并将其称为production.nsf。最后,使用production.ntf替换production.nsf的设计。仔细检查代理是否存在,并确保它们不受设计刷新/替换操作的影响。 (一些版本的设计师把它搞砸了!)计划同步按照你需要的频率运行,并且计划清除每天或每周运行。将production.nsf复制到所有服务器,并将用户移动到production.nsf。 (注意:你可以做反向操作,在清除后让你的用户保留在现有的数据库中;但老实说,我认为从一个全新的NSF开始,你会得到额外的性能提升,这就是为什么我写了它)

+0

我给了你一个答案的投票,令人印象深刻。不知道这是我之后的解决方案,需要更简单一些。目前正在考虑是否允许我从一台服务器中删除一个副本,并创建一个选择性公式副本。通过这种方式,我可以将用户引导至一台服务器以用于迷你版本,另一台服务器用于完整版本。 –

+1

你能做到这一点,但我不得不说的是,以上是最简单安全的解决方案,我可以推荐。恕我直言选择性复制是真正的邪恶。我知道这是一个永远支持的功能,但我不相信它。我看到事情出错的方式太多了。例如,管理员启动复制从他的客户,而不是发出服务器“代表”或“拉”命令,选择复制被绕过。更糟糕的是,由于没有明显的原因,在一些复制周期中复制时间会增加,而其他复制周期中似乎是正常的。 –

+0

关于最后一条评论,我确实怀疑导致长时间复制的原因。我从来没有能够明确地证明这一点,但我曾经收集过大量证据表明,在NSF中涉及重复复制公式,并强烈建议在选择性复制管理UI中的错误负责在任何时候创建重复项只是为了看看这个公式。如果他们按下确定而不是从该对话框中取消,而不进行更改,则有时会创建重复项。 –

0

我真的很喜欢理查德的解决方案,但是我最近实现了一个我喜欢到目前为止的推导。基本上,将来自每个文档的元数据放入一个单独的数据库中,这是您的“索引”,当他们打开索引文档时,它会在alldocs.nsf中打开文档(并关闭索引文档)。

为此,请在alldocs.nsf中编写一个代理程序,以便在文档被修改或保存时创建索引文档。它应该只复制想要用于索引的字段(元数据)。示例代码要做到这一点(不包括子例程或函数调用)从我复制事件主剂:

Sub Initialize 
Dim session As New NotesSession 
Dim maindb As NotesDatabase ' Main SIR 
Dim mainincidents As NotesView ' view in Main SIR 
Dim maindoc As NotesDocument ' document in Main SIR 
Dim projectdoc, nextprojectdoc As NotesDocument ' document in this database 
Dim ndc As NotesDocumentCollection ' unprocessed documents in this database 
Dim fieldItem As NotesItem 
Dim reportnumber, value, formtype As Variant 
Dim fieldsToCopy (10) As String 
Dim reason As String 

On Error GoTo errorhandler 

Call StartAgentLogging (session) 

Set thisdb = session.Currentdatabase 

' find all unstamped documents 
Set ndc = thisdb.Unprocesseddocuments 

If ndc.Count = 0 Then 
    Call agentLog.LogAction ("No incidents to process") 
    Exit Sub 
End If 

maindbfilepath = DetermineKeyword("MAINSIR") 
Set maindb = session.Getdatabase("","") 
Call maindb.Open("", maindbfilepath) 

If Not maindb.Isopen Then 
    reason = "Main Security database could not be found at " & maindbfilepath 
    Call agentLog.LogAction (reason) 
    MessageBox reason, 16, "Error" 
    Exit Sub 
End If 

Set mainincidents = maindb.Getview("(Incidents for Upload)") 
Set projectdoc = ndc.Getfirstdocument() 
fieldsToCopy (0) = "ReportType" 
fieldsToCopy (1) = "ReportNumber" 
fieldsToCopy (2) = "ReportDate" 
fieldsToCopy (3) = "IncidentDate" 
fieldsToCopy (4) = "ProjectName" 
fieldsToCopy (5) = "ProjectCountry" 
fieldsToCopy (6) = "ProjectLocation" 
fieldsToCopy (7) = "ReporterName" 
fieldsToCopy (8) = "ReporterPhone" 
fieldsToCopy (9) = "ReporterEmail" 
fieldsToCopy (10) = "Appointment" 

While Not projectdoc Is Nothing 
    formtype = projectdoc.GetItemValue ("Form") 
    If formtype(0) = "Incident" Then 
     ' check to see if that exists in the main SIR 
     reportnumber = projectdoc.GetItemValue("ReportNumber") 
     Call agentLog.LogAction ("Checking " & reportnumber(0)) 
     Set maindoc = mainincidents.GetDocumentByKey(reportnumber(0), True) 
     Call agentLog.LogAction ("Accessing " & reportnumber(0)) 

     If maindoc Is Nothing Then 
      Call agentLog.LogAction ("Main does not contain " & reportnumber(0) & " creating new document.") 
      ' if not, create new document 
      Set maindoc = maindb.Createdocument() 
      maindoc.Form = "Incident" 

      ForAll fieldname In fieldsToCopy 
       Call agentLog.LogAction ("Field name: " & fieldname) 
       Set fieldItem = projectdoc.Getfirstitem(fieldname) 
       Call maindoc.Copyitem(fieldItem, fieldname) 
      End ForAll 

      Call maindoc.Save(True, False) 
      Call CreateNotice (maindoc) 
     Else 
      Call agentLog.LogAction ("Main contains " & reportnumber(0) & " updating document.") 
      ' if it does, update data 
      ForAll fieldname In fieldsToCopy 
       Call agentLog.LogAction ("Field name: " & fieldname) 
       value = projectdoc.GetItemValue(fieldname) 
       Call maindoc.ReplaceItemValue(fieldname, value(0)) 
      End ForAll 
     End If 

     'Path and filename 
     Call maindoc.Replaceitemvalue("Path", thisdb.Filepath) 
     Call maindoc.Save(True, False) 
     Call agentLog.LogAction ("Saved " & reportnumber(0)) 
    Else 
     Call agentLog.LogAction ("Project form is " & projectdoc.Form(0)) 
    End If 

    ' stamp document as processed 
    Set nextprojectdoc = ndc.GetNextDocument(projectdoc) 
    Call session.Updateprocesseddoc(projectdoc) 
    Set projectdoc = nextprojectdoc 
Wend 

exiting: 
    Exit Sub 
errorhandler:' report all errors in a messagebox 
    reason = "Error #" & CStr (Err) & " (" & Error & ") when creating incident in Main database, on line " & CStr (Erl) 
    Call agentLog.LogAction (reason) 
    MessageBox reason, 16, "Error" 
    Resume exiting 
End Sub 

然后,你需要添加代码到索引形式的onload事件在索引数据库。我把它放在一个由ToolsRunMacro调用的代理中,但你可以直接放入它。这是我的打开项目复制剂。现在

Sub Initialize 
' this button opens the incident report in the project database 
Dim ws As New NotesUIWorkspace 
Dim session As New NotesSession 
Dim reportdb As NotesDatabase 
Dim view As NotesView 
Dim uidoc As NotesUIDocument 
Dim thisdoc, reportdoc As NotesDocument 
Dim filepath, reportnumber As Variant 
Dim baseurl, opener, unid As String 

Call StartAgentLogging (session) 
Set thisdb = session.Currentdatabase 

Set uidoc = ws.CurrentDocument 
Set thisdoc = uidoc.Document 
filepath = thisdoc.GetItemValue ("Path") 
reportnumber = thisdoc.GetItemValue ("ReportNumber") 

Set reportdb = session.GetDatabase (thisdb.Server, filepath (0), False) 
If reportdb Is Nothing Then 
    MessageBox ("Could not find Project Security Incident Report database" & Chr$(10) & thisdb.Server & "\" & filepath(0)) 
    Call agentLog.LogAction ("Could not find Project Security Incident Report database" & Chr$(10) & thisdb.Server & "\" & filepath(0)) 
    Exit Sub 
End If 
If Not reportdb.Isopen Then 
    Call reportdb.Open(thisdb.Server, filepath (0)) 
End If 
Set view = reportdb.GetView ("Incidents") 
Set reportdoc = view.GetDocumentByKey (reportnumber(0)) 
If reportdoc Is Nothing Then 
    MessageBox ("Could not find Report #" & reportnumber(0)) 
    Call agentLog.LogAction ("Could not find Report #" & reportnumber(0)) 
    Exit Sub 
End If 

Call uidoc.Close 
unid = reportdoc.UniversalID 
baseurl = reportdb.NotesURL 
opener = Left$ (baseurl, InStr (baseurl, "?") -1) & "/Incidents/" & unid & "?OpenDocument" 
Call ws.URLOpen (opener) 
Call agentLog.LogAction ("Opened Report #" & reportnumber(0)) 
End Sub 

,你可能会限制索引数据库只针对文件最近一年或者看看它是如何工作的,当所有的文件都在里面。很大程度上取决于您需要在视图中提供多少数据。

在我的情况,索引数据库包含来自多个数据库中的文档索引文件,并作为“全数据”数据库中心接入点。它仍在测试中,所以我不确定它对我的工作有多好,但我认为我会为您提供它。