A batch file to back up all active-state BlackBerry databases

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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.