2. Maintain Public Folder Databases
There is not a lot of work
required to maintain public folder databases. Public folders perform
automatic maintenance that takes care of everything that needs to be
cleaned up inside the database on a regular basis. Other than
maintenance of the content stored inside the database, the other
maintenance aspect that you need to be aware of is maintaining the
database object and its files. This section discusses this in detail,
including steps for moving a database to a different location as well as
steps for completely removing a database from a server.
2.1. Manage the Database Maintenance Schedule
Online maintenance of a
database occurs automatically on a predefined interval. During this
period, Exchange cleans up several aspects of the databases, including
things like purging old indexes, tombstones (items which, from the
user's perspective, have been deleted but are still kept in the database
for replication purposes), and expired folders. This is all configured
out of the box, so you do not have to do anything to ensure that this
maintenance is run on a regular basis. However, you can modify the
timeframes that this maintenance work is performed during.
When modifying the
maintenance window, ensure that you allow adequate time for the process
to run. Because of efficiencies gained in the online maintenance process
in Exchange 2010, this maintenance window can be smaller than in
previous versions. Depending on the size of your database, you may only
need to allocate a couple of hours for this process. If maintenance
can't be completed in one sitting, the process will pick up where it
left off during the next maintenance window.
You can modify the maintenance schedule on a public folder database in the EMC using the following steps:
Open the EMC and browse to the Organization Configuration => Mailbox node in the Console tree.
Select the Database Management tab in the Work area.
From
the list of public folder databases, select the public folder database
that you want to modify the maintenance schedule for.
In the Actions pane, select the Properties option from the Action menu for the public folder database that you have selected.
In the properties dialog box for the public folder database, click the General tab.
In
the Maintenance Schedule field, select the maintenance schedule that
you want to use from the drop-down list. If you click the Customize
button, you can create your own custom maintenance schedule instead of
using a predefined one.
Click OK to make the changes and close the properties dialog box.
To set the maintenance schedule for public folder databases in the EMS, you use the Set-PublicFolderDatabase cmdlet with the MaintenanceSchedule parameter. In the MaintenanceSchedule parameter, you will specify the day and time that maintenance starts and ends. You can use the format Day.H:MM for this time value. For example, Friday at 3:00 a.m. would be Fri.3:00 AM. There must be a space between the time and the AM/PM.
Also, when you specify the time range, the hyphen between the times
should not have any spaces around it, as shown in this example. The
following example sets the maintenance schedule on the public folder
database to be Thursday from 8 p.m. to Friday at 4 a.m.
Set-PublicFolderDatabase "PFDB (CONTOSO-PF01)"
-MaintenanceSchedule "Thu.8:00 PM-Fri.4:00 AM"
2.2. Move Public Folder Database Files
You can move the database and
log files of a public folder database to another location on your
server. When you move the files, the database will need to be
dismounted. This means that users that are connected to the database
will be temporarily disconnected. Before moving the database, you will
need to ensure that the new location for the files is large enough to
hold them.
To move the public folder database in the EMC, follow these steps:
Open the EMC and browse to the Organization Configuration => Mailbox node in the Console tree.
Click on the Database Management tab in the Work area. The list of public folder databases is displayed in the tab.
Select the public folder database that you want to move and click the Move Database Path option in the Actions pane.
In
the Move Database Path wizard, type the location of the new database
file in the Database File Path field. Ensure you put the name of the
file at the end of this path—for example, C:\PF01\PF01.edb. Enter the
new location for the logs in the Log Folder Path field.
Click the Move button to move the database and logs to the new location.
At the Completion screen, click the Finish button.
To move the public folder database through the EMS, you can use the Move-DatabasePath
cmdlet. When you run this command, identify the database that you are
moving and the new location for the database files and the log files.
The EdbFilePath parameter is used to
specify the database location. Make sure that you include the name of
the database file at the end of the path—for example, C:\NewPath\PFDB.edb. For specifying the new location of the log files, you will use the LogFolderPath
parameter. This parameter should specify the folder that the log files
will be kept in, so make sure it's a valid folder path. The following
command demonstrates how to move the public folder database files to a
new location on the same server.
Move-DatabasePath PFDB -EdbFilePath "C:\DB\PFDB\PFDB.edb"
-LogFolderPath "C:\DB\PFDB"
2.3. Delete a Public Folder Database
Before you can delete a public
folder database, you must make sure that the database does not contain
any data. Therefore, any public folder data in that database should be
either deleted or moved to another server.
When you delete the
database using the tools in Exchange, the database files remain on the
disk. You should back these files up before deleting them unless you are
sure that you will never need to recover the data.
Exercise care if you are
going to delete the last public folder database in the organization.
Make sure that your users are not using the database for anything, such
as Offline Address Book distribution or organizational forms.
|
|
To delete a public folder database in the EMC, follow these steps:
Open the EMC and browse to the Organization Configuration => Mailbox node.
In the Work area, select the Database Management tab. The list of databases that currently exist is displayed.
Select the public folder database that you want to remove from the list of databases.
In the Actions pane, select the Remove option from the Action menu for the public folder database that you have selected.
You
will be prompted with a dialog box asking you if you are sure that you
want to remove the database. Click the Yes button to continue.
The
public folder database that you selected is removed. A dialog box will
be displayed that instructs you to remove the database files for the
public folder manually, as shown in Figure 2. Make note of the location of the old public folder database files and then click OK to close the dialog box.
Open a command prompt window by clicking Start => All Programs => Accessories => Command Prompt.
Type the following command, replacing the D:\Databases\PF01.edb file path with the location of the old public folder database file. This will delete the old public folder database file.
del D:\Databases\PF01.edb
Type the following commands, replacing the D:\Databases\PF01Logs folder path with the location of the old public folder log files. The folder and the log files will be deleted.
del D:\Databases\PF01Logs /Q
rd D:\Databases\PF01Logs
You can remove a public
folder database in the EMS using the Remove-PublicFolderDatabase cmdlet.
The only parameter that you need to specify when running this command
is the name of the public folder database that you are removing. As with
the steps for removing the database in the EMC, you will need to
manually remove the database and log files after you've deleted the
database from Exchange. The following example shows how to use this
command:
Remove-PublicFolderDatabase "PFDB" -Confirm:$False
You can also use the
following PowerShell script to delete the public folder database and
remove the database files for you. Specify the name of the public folder
database as the input parameter into this script. For example, you
would execute the script using the following command:
.\RemovePFDB.ps1 "PFDB"
RemovePFDB.ps1 Script
## File Name: RemovePFDB.ps1
## Description: Removes the specified public folder database
## and deletes its associated files.
## Check the input parameter
Param( [string] $PFDB = "" )
If ($PFDB -eq "")
{
""
"You must specify a database to remove."
""
"EXAMPLE:"
"`t[PS] C:\> .\RemovePFDB.ps1 ""PFDB01"""
""
exit;
}
## Get the properties of the database
$PFDBObj = Get-PublicFolderDatabase $PFDB
$PFDBEDB = $PFDBObj.EDBFilePath
$PFDBLogs = $PFDBObj.LogFolderPath