Are you maintaining a BlackBerry Enterprise Server on one of your Lotus Domino servers with a few hundred BlackBerry users? Do you have a lot of orphan state databases due to improper adding or removing of users? Do you wish you had a program that could automatically back up active state BlackBerry databases in a folder first, so you can perform a one-time clearing of the "BESState" data folder without the fear of removing active state databases?
If any of the above is on your wish list, then this LotusScript agent is for you. Once it is executed in the BlackBerry User Profiles database, it will create a DOS batch file entitled "C:backup_state.bat" that will allow you to copy all active state BlackBerry databases to a temporary folder called: "C:Backup."
All you need to do is hit "Ctrl+A" and then hit the "Delete" key to clear the databases in the "BESState" folder. Later on, move those active state databases from the "C:backup" folder back to their original location and you're done!
Remarks: OS-level NSF files copy is same as creating database replicas. Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim strSearchFormula As String Dim docCollection As NotesDocumentCollection "/***Search for all profile documents with a ACTIVE state database ***/ Set db = session.CurrentDatabase strSearchFormula = | Form = "Account" & Deleted != "1" | Set docCollection = db.Search(strSearchFormula, Nothing,0) '/***Prepare the file handle for creating the BATCH file ***/ Dim hFileNum As Integer strFileName= "C:backup_state.bat" 'Creating a batch file hFileNum = Freefile() Open strFileName For Output As hFileNum '/***Get the State database filepath for each profile documents in the collection ***/ If docCollection.Count <> 0 Then For i=1 To docCollection.Count Set doc=docCollection.GetNthDocument(i) strStateDBFilePath = doc.rtStateDBLink(0) '/***Format the string for the DOS copy command ***/ strFormatString = |copy | + |"| + strStateDBFilePath +|"| + " c:backup" 'Write formatted string to output file Print #hFileNum, strFormatString Next End If Close hFileNum End Sub
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Teck Lung Ng. Please let
others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino,
Workplace or WebSphere tip or code snippet to share? Submit it to our monthly
tip contest and you could win a prize.
This was first published in September 2006