2012-09-25 199 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 

,你可能會限制索引數據庫只針對文件最近一年或者看看它是如何工作的,當所有的文件都在裏面。很大程度上取決於您需要在視圖中提供多少數據。

在我的情況,索引數據庫包含來自多個數據庫中的文檔索引文件,並作爲「全數據」數據庫中心接入點。它仍在測試中,所以我不確定它對我的工作有多好,但我認爲我會爲您提供它。