Recipe6.4.Creating a Mailbox Database


Recipe 6.4. Creating a Mailbox Database

Problem

You wish to create one or more additional mailbox databases in an existing storage group.

Solution

Using a graphical user interface

  1. Launch the Exchange System Manager (Exchange System Manager.msc).

  2. In the left pane, expand the appropriate Administrative Groups container, and then expand the Servers container.

  3. Expand the server that contains the target storage group.

  4. Right-click the target storage group and choose New Mailbox Store.

  5. When the Properties dialog appears, enter a name for the database.

  6. Optionally, use the Database tab to select a location for the EDB and STM files.

  7. Optionally, use the Limits and Full-Text Indexing tabs to adjust properties on the database.

  8. Click OK.

  9. ESM will display a confirmation dialog to ask if you want the store mounted or not. Click Yes to mount the store or No to leave it dismounted.

Using VBScript
' This code creates a new mailbox database in the first storage group ' of the target server and then mounts it. ' ------ SCRIPT CONFIGURATION ------  strServerName = "<serverName>"   ' e.g., "BATMAN"      strMDBName = "<databaseName>"    ' e.g., "SpiffyNewDatabase"  ' ------ END CONFIGURATION --------- Set theServer = CreateObject("CDOEXM.ExchangeServer") Set theMDB = CreateObject("CDOEXM.MailboxStoreDB") ' bind to the Exchange server and build the database URL theServer.DataSource.Open strServerName arrSG = theServer.StorageGroups theFirstSG = arrSG(0) strURL = "LDAP://" & theServer.DirectoryServer & "/cn=" & _            strMDBName & "," & theFirstSG wscript.echo "Creating database " & Chr(34) & strMDBName & _          Chr(34) & " on " & theFirstSG theMDB.Name = strMDBName theMDB.DataSource.SaveTo strURL WScript.Echo "Database created." theMDB.Mount WScript.Echo "Database mounted."

Discussion

When you create a new mailbox database, Exchange generates a new, empty EDB file and fills it with the structures necessary to contain mailbox data. It also generates a matching STM file, which is empty until you start moving or creating mailboxes in the new store. By default, newly created stores aren't mounted; ESM will ask you if you want to mount the store, while you can use the Mount method on the mailbox store interface to mount a newly created store programmatically.

The previous VBScript example uses the CDOEXM MailboxStoreDB interface to create a new database in the first SG on the server. You can easily modify the code to create databases in a named SG by specifying the URL of the SG instead of looking up the first one. If you do not wish to mount the store, simply comment out the last two lines of the VBScript example.

See Also

Recipe 6.5 for creating a public store, Recipe 6.6 for deleting a database, Recipes Recipe 6.7 and Recipe 6.8 for mounting or dismounting a database, and MSDN: IMailboxStoreDB



Exchange Server Cookbook
Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
ISBN: 0596007175
EAN: 2147483647
Year: 2006
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net