Now that you know how to create and use databases, let's look at some general techniques you'll use to manage them.
You can access only databases that are mounted. If a database isn't mounted, the database isn't available for use. This means that an administrator has probably dismounted the database or that the drive on which the database is located isn't online.
Real World A dismounted database could also point to problems with the database, transaction log, and system files used by the database. During startup, Exchange Server 2007 obtains a list of database files registered in Active Directory and then checks for the related files before mounting each database. If files are missing or corrupted, Exchange Server 2007 will be unable to mount the database. Exchange Server 2007 then generates an error and logs it in the application event log on the Exchange server. The most common error is Event ID 9547. An example of this error follows:
The Active Directory indicates that the database file D:\Exchsrvr\mdbdata\Marketing.edb exists for the Microsoft Exchange Database /o=My Organization/ou=First Administrative Group/ cn=Configuration/cn=Servers/ cn=MAILER2/ cn=Marketing, however no such files exist on the disk.
This error tells you that the Exchange database (Marketing.edb) is registered in Active Directory, but Exchange Server 2007 is unable to find the file on the disk. When Exchange Server 2007 attempts to start the corrupted mailbox database, you'll see an additional error as well. The most common error is Event ID 9519. An example of this error follows:
Error 0xfffffb4d starting database First Storage Group∖Marketing on the Microsoft Exchange Information Store.
This error tells you that Exchange Server 2007 couldn't start the Marketing database. To recover the mailbox database, you must restore the database file, as discussed in Chapter 18, "Backing Up and Restoring Microsoft Exchange Server 2007," in the section "Recovering Exchange Server." If you are unable to restore the database file, you can re-create the database structures in Exchange Management Console by mounting the database. When you mount the database, Exchange Server 2007 creates a new database file, and, as a result, all the data in the database is lost and cannot be recovered. Exchange Server 2007 displays a warning before mounting the database and re-creating the database file. Click Yes only when you are absolutely certain that you cannot recover the database.
Mailbox and public folder databases have several associated states, including:
Mounted
Dismounted
Backup In Progress
Online Maintenance In Progress
Replication In Progress
You can determine the status of a database by following these steps:
In Exchange Management Console, expand the Server Configuration node, and then select the related Mailbox node.
In the details pane, select the Mailbox server you want to examine. You should see a list of storage groups that are available on the server.
For each storage group, you should see a list of available databases. The icon to the left of the database name indicates the mount status. If the icon shows a gray down arrow, the database isn't mounted. Otherwise, the database is mounted.
To determine the status of the database, right-click the database, and then select Properties. In the Properties dialog box, the status is listed on the General tab.
In Exchange Management Shell, you can determine the status of all or specific databases using the get-MailboxDatabase and get-PublicFolderDatabase cmdlets. Sample 12-8 provides the syntax and usage for these cmdlets. To see status details, you must specify the status flags associated with each state you want to see as part of the formatted output. The Mounted, Dismounted, Backup In Progress, Online Maintenance In Progress, and Replication In Progress status values are then listed as True or False.
Sample 12-8: Getting database status details
Syntax get-MailboxDatabase [-Identity 'MailboxDatabaseIdentity'] [-Server'ServerIdentity'] -Status | format-table Name, StorageGroup, Mounted, BackupInProgress, OnlineMaintenanceInProgress get-PublicFolderDatabase [-Identity 'PublicFolderDatabaseIdentity'] [-Server 'ServerIdentity'] -Status $true | format-table Name, StorageGroup, Mounted, BackupInProgress, OnlineMaintenanceInProgress, ReplicationInProgress Usage for specific database and server get-MailboxDatabase -Identity 'CORPSVR127\Storage Group 2\Eng DB' -Status | format-table Name, StorageGroup, Mounted, BackupInProgress, OnlineMaintenanceInProgress Usage for all databases on a server get-MailboxDatabase -Server 'CORPSVR127' -Status | format-table Name, StorageGroup, Mounted, BackupInProgress, OnlineMaintenanceInProgress Usage for all databases get-MailboxDatabase -Status | format-table Name, StorageGroup, Mounted, BackupInProgress, OnlineMaintenanceInProgress
You should rarely dismount an active database, but if you need to do so, follow these steps:
In Exchange Management Console, expand the Server Configuration node, and then select the related Mailbox node.
In the details pane, select the Mailbox server you want to manage. You should see a list of storage groups that are available on the server.
For each storage group, you should see a list of available databases. The icon to the left of the database name indicates the mount status. If the icon shows a gray down arrow, the database is already dismounted.
If LCR is enabled for the storage group in which the database is stored, right-click the storage group, and then select Suspend Local Continuous Replication. When prompted to confirm the action, type a comment to record in the application event log, and then click Yes.
Right-click the database you want to dismount, select Dismount Database, and then confirm the action by clicking Yes. Exchange Server dismounts the database. Users accessing the database will no longer be able to work with their server-based folders.
After you've dismounted a database and performed maintenance, recovery, or other procedures as necessary, you can remount the database by completing the following steps:
In Exchange Management Console, expand the Server Configuration node, and then select the related Mailbox node.
In the details pane, select the Mailbox server you want to manage. You should see a list of storage groups that are available on the server. For each storage group, you should see a list of available databases.
The icon to the left of the database name indicates the mount status. You should see a gray down arrow indicating that the database isn't mounted. If so, right-click the database, and then select Mount Database.
The new database isn't accessible to users that are currently logged on to Exchange server. Users need to exit and then restart Outlook before they can access the newly mounted database.
If LCR is enabled for the related storage group, right-click the storage group, and then select Resume Local Continuous Replication. When prompted to confirm the action, click Yes.
In Exchange Management Shell, you can dismount and mount databases using the dismount-Database and mount-Database cmdlets, respectively. Sample 12-9 provides the syntax and usage for these cmdlets.
Sample 12-9: Dismounting and mounting databases
Syntax dismount-Database -Identity 'DatabaseIdentity' mount-Database -Identity 'DatabaseIdentity' Usage for dismounting a database dismount-Database -Identity 'CORPSVR127\Storage Group 2\Eng DB' Usage for mounting a database mount-Database -Identity 'CORPSVR127\Storage Group 2\Eng DB'
Normally, Exchange Server automatically mounts databases on startup. You can, however, change this behavior. For example, if you're recovering an Exchange server from a complete failure, you might not want to mount databases until you've completed recovery. In this case, you can disable automatic mounting of databases.
To enable or disable automatic mounting of a database, complete the following steps:
In Exchange Management Console, expand the Server Configuration node, and then select the related Mailbox node.
In the details pane, select the Mailbox server you want to manage. You should see a list of storage groups that are available on the server. For each storage group, you should see a list of available databases.
Right-click the database you want to work with, and then select Properties.
To ensure that a database isn't mounted on startup, select the Do Not Mount This Database At Start-Up check box.
To mount the database on startup, clear the Do Not Mount This Database At Start-Up check box. Click OK.
In Exchange Management Shell, you can enable or disable automatic mounting at startup using the set-MailboxDatabase and set-PublicFolderDatabase cmdlets. Sample 12-10 provides the syntax and usage for controlling automatic mounting.
Sample 12-10: Controlling automatic mounting
Syntax set-MailboxDatabase -Identity 'DatabaseIdentity' -MountAtStartup Switch set-PublicFolderDatabase -Identity 'DatabaseIdentity' -MountAtStartup Switch Usage set-MailboxDatabase -Identity 'CORPSVR127\Storage Group 2\Eng DB' -MountAtStartup $false
You should run maintenance routines against databases on a daily basis. The maintenance routines organize the databases, clear out extra space, and perform other essential housekeeping tasks. By default, Exchange Server runs maintenance tasks daily from 1:00 A.M. to 5:00 A.M. If this conflicts with other activities on the Exchange server, you can change the maintenance schedule by following these steps:
In Exchange Management Console, right-click the database you want to work with, and then select Properties.
On the General tab in the Properties dialog box, use the Maintenance Schedule list to set a new maintenance time. Select a time (such as Run Daily From 11:00 P.M. To 3:00 A.M.) or select Use Custom Schedule. Click OK.
Tip If you want to set a custom schedule, select Use Custom Schedule, and then click Customize. You can now set the times when maintenance should occur.
In Exchange Management Shell, you can configure the maintenance schedule for a database using the set-MailboxDatabase and set-PublicFolderDatabase cmdlets. Sample 12-11 provides the syntax and usage. In the example, replication is configured to occur daily between the hours of 1:00 AM and 5:00 AM.
Sample 12-11: Setting the maintenance schedule
Syntax set-MailboxDatabase -Identity 'DatabaseIdentity' -MaintenanceSchedule Schedule set-PublicFolderDatabase -Identity 'DatabaseIdentity' -MaintenanceSchedule Schedule Usage set-MailboxDatabase -Identity 'CORPSVR127\Storage Group 2\Eng DB' -MaintenanceSchedule 'Daily.1:00.AM-Daily.5:00.AM'
As discussed earlier, each database has a database file associated with it, and the location of this file has an important role in managing Exchange Server performance. If you enable LCR, you can have separate backup locations for the database file as well.
You can change the database file and local continuous backup locations for a database by completing the following steps:
In Exchange Management Console, expand the Server Configuration node, and then select the related Mailbox node.
In the details pane, select the Mailbox server you want to manage. You should see a list of storage groups that are available on the server.
If LCR is enabled for the storage group, right-click the storage group, and then select Suspend Local Continuous Replication. When prompted to confirm the action, type a comment to record in the application event log, and then click Yes.
Right-click the database you want to move, and then select Move Database Path from the shortcut menu. You should now see the Move Database Path wizard, as shown in Figure 12-6.
Figure 12-6: Move the database and its backup to new locations.
Click Browse to the right of the Database File Path text box, select a new location for the database file, and then click Save. The folder location must already exist. If the folder location doesn't exist, you'll need to create it in Windows Explorer before trying to move the file.
If LCR is enabled for the related storage group, set the backup location for the database file using the Browse button provided. Select a backup location, and then click Save.
Click Move. Exchange will validate the paths you've provided and then move the files. Click Finish when this process completes.
Note | If you've enabled LCR but replication has not yet begun, you may see an error stating that the backup paths are invalid. This occurs because there are no backup files to copy at this time, and you can ignore the error. |
If LCR is enabled for the related storage group, right-click the storage group, and then select Resume Local Continuous Replication. When prompted to confirm the action, click Yes.
In Exchange Management Shell, you can move databases using the move-Database-Path cmdlet. Sample 12-12 provides the syntax and usage. With LCR, you must suspend copying of the related storage group before moving the database and then resume copying after moving the database.
Sample 12-12: move-DatabasePath cmdlet syntax and usage
Syntax move-DatabasePath -Identity 'DatabaseIdentity' [-CopyEdbFilePath 'FilePath'] -EdbFilePath 'FilePath' Usage move-DatabasePath -Identity 'CORPSVR127\Third Storage Group\Sales DB' -CopyEdbFilePath 'I:\ReplCopies\First Storage Group\AccountingMail.edb' -EdbFilePath 'K:\Databases\First Storage Group\SalesMail.edb'
To rename a database, follow these steps:
In Exchange Management Console, right-click the database, and then select Properties.
In the Properties dialog box, type the new name for the database. Click OK.
Note | All objects in Active Directory are located by a unique identifier. This identifier uses the directory namespace and works through each element in the directory hierarchy to a particular object. When you change the name of a database, you change the namespace for all the objects in the database. |
In Exchange Management Shell, you can rename databases using the –Name parameter of the set-MailboxDatabase and set-PublicFolderDatabase cmdlets. Sample 12-13 provides the syntax and usage.
Sample 12-13: Setting the maintenance schedule
Syntax set-MailboxDatabase -Identity 'DatabaseIdentity' -Name 'NewName' set-PublicFolderDatabase -Identity 'DatabaseIdentity' -Name 'NewName' Usage set-MailboxDatabase -Identity 'CORPSVR127\Storage Group 2\Eng DB' -Name 'Engineering Mail Database'
Deleting a database removes the database and all the public folders or mailboxes it contains. Before you delete a database, make sure that you no longer need the items it contains. If they are necessary, you should move them to a new database. You move mailboxes as described in Chapter 8, "Mailbox Administration" in the section "Moving Mailboxes." With public folders, public folder data is replicated between or amongst the public folder databases automatically. As long as all data has been replicated, you could remove a public folder database from a Mailbox server without losing data. However, as each Mailbox server can only have one public folder database, you'd need to create a new public folder database to ensure that users with mailboxes on the server can access public folder data.
After you've moved items that you might need, you can delete the database by completing the following steps:
In Exchange Management Console, right-click the database you want to delete, and then select Remove from the shortcut menu.
When prompted, confirm the action by clicking Yes.
In Exchange Management Shell, you can delete databases using the remove-Mailbox-Database and remove-PublicFolderDatabase cmdlets. Sample 12-14 provides the syntax and usage.
Sample 12-14: Removing databases
Syntax remove-MailboxDatabase -Identity 'DatabaseIdentity' remove-PublicFolderDatabase -Identity 'DatabaseIdentity' Usage remove-MailboxDatabase -Identity 'CORPSVR127\Storage Group 2\Eng DB'