Manage Learn to apply best practices and optimize your operations.

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

Learn how to create a LotusScript agent that will make a DOS batch file to automatically back up all your active state BlackBerry databases to a specified folder.

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 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.

Dig Deeper on Mobile and Wireless Development for Lotus Notes Domino

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...