A tool for moving databases: Part II

This tip is part two of a previous tip on a tool for moving databases

Last month I posted a tool for automatically moving databases from one server to another.

The tool, which I call DB Mover, automates many of the tasks associated with a database move, which is more complicated that it might sound.

The tool performs all of the following steps for each database being moved: replicate the database to the new server; change the Help-About document of the old database so it points to the new database; change the launch property of the old database to always show Help-About; make the old database read-only; disable replication of the old database; change the admin server in the new replica; change the "run on" server for the agents. DB Mover also allows you to turn on/off each of these steps, so you can use the tool to do any of the above operations to any database. And, you can move many databases at once, with one press of a button.

Last month's tip did not give any details about how the tool worked. So that's my topic this month. Most of the tool is written with standard Lotuscript, which you are free to read in the agent named Move Databases and all of its subroutines. There are two areas of the code, however, which use little-known features, so I will focus on those aspects.

The agent subroutine named SetLaunch changes the launch property of each old database so that the database always shows the Help-About document when it is opened. The launch properties of a database are stored in the icon note, which has a NoteID of FFFF0010. Within this note, the launch properties are a set of flags stored in the field named $Flags. The flag p means "always show the About document to Notes users", and the flag P means "always show the About document to Web users." Also, be sure to set the SUMMARY flag for the $Flags field after changing its value.

By far, the hardest part of the coding was modifying the Help-About document so it points to the new database. It is very difficult (nearly impossible) to create a button from any programming language. The solution is to pre-create a link button with variable fields for the server and filename of the new database, then to fill in those fields programmatically. Unfortunately, Help-About documents are not normal documents, with normal Notes front-end properties. So you must read the fields by opening the document with back-end classes.

The pre-written button is found in the view named Setup Controls within the control named New About Doc 1. This control contains a rich-text field that contains the button we want, Open New Database. The agent subroutine named ModifyAbout extracts the rich-text field (including the button) and writes it to the Help-About document of the old database. The subroutine uses the fact that Help-About documents always have a NoteID of FFFF0002. The subroutine copies the pre-written button into the Help-About document of the old databases, and sets two other special fields within Help-About. The first of these fields holds the name of the new server, and the second holds the filename of the new database within the new server.

When a user opens the old database, they automatically see the Help-About document (since we changed the launch properties) and the button Open New Database. When the user presses the button, the LotusScript code behind the button extracts the name of the new server and filename (from their special fields) and then opens the new database. Note that the button must be coded in LotusScript and use the back-end classes to read the additional fields within Help-About. Simple @-functions will not work within Help-About because extra fields are not visible in the normal way.

As I said last month, you may use DB Mover in any way that you like, including modifying or improving its code. The only restriction is that you must continue to give me credit for creating the tool, by including my name and web link in the Help-About and Help-Using documents. Here it is on my download page: http://www.chc-3.com/downloads/dbmover103.zip

Chuck Connell is president of CHC-3 Consulting , which helps organizations with all aspects of Domino and Notes. CHC-3 allows companies to outsource their Domino administration needs via DominoAdministration.com and runs the popular security site DominoSecurity.org .

Dig Deeper on Lotus Notes Domino Database Management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com'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 ...