Tuesday, December 18, 2007

Relocating the Exchange 2007 Queue Database

Summary from the "How to Change the Location of the Queue Database" article in the Exchange Server TechCenter:

Microsoft Exchange Server 2007 uses an Extensible Storage Engine (ESE) database for queue message storage. Formerly known as JET, ESE is a method that defines a low-level API to the underlying database structures in Exchange Server. All the different queues are stored in a single ESE database. Queues exist only on servers that have the Hub Transport server role or the Edge Transport server role installed.

The location of the queue database is controlled by the QueueDatabasePath parameter in the EdgeTransport.exe.config application configuration file that is located in the C:\Program Files\Microsoft\Exchange Server\Bin directory. The location of the logs is controlled by the QueueDatabaseLoggingPath parameter in the same file.  The following list describes some important items to consider when you change the location of the queue database and logs:

  • If the target directory doesn't exist, it will be created for you if the parent directory has the following permissions applied to it:
    • Network Service: Full Control
    • System: Full Control
    • Administrators: Full Control
  • The existing queue database files Mail.que and Trn.chk are not moved. New queue database files are created at the new location after you save the EdgeTransport.exe.config application configuration file and restart the Microsoft Exchange Transport service. The existing database files are left at the old location. However, they are no longer used.
  • The existing queue database transaction log files Trn.log, Trntmp.log, Trnnnn.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb are not moved. New queue database transaction logs are created at the new location after you save the EdgeTransport.exe.config application configuration file and restart the Microsoft Exchange Transport service. The existing transaction log files are left at the old location. However, they are no longer used.
  • If you want to change the location of the queue database but reuse the existing queue database files, you must move or copy the database files when the Microsoft Exchange Transport service is stopped.  The same goes for the logs.

The steps to move the database (and logs) are as follows:

  • Create the target directory (or directories if you are moving the logs to a separate location)
  • Edit the QueueDatabasePath parameter in the EdgeTransport.exe.config file to reflect the new database path
  • Edit the QueueDatabaseLoggingPath parameter in the EdgeTransport.exe.config file to reflect the new database path
  • Stop the Microsoft Exchange Transport service
  • If preserving the old database (which you should because there is likely mail in there that has yet to be delivered), move the Mail.que and Trn.chk from the original location to the new location.
  • If preserving the old logs (again, which you should) move the Trn.log, Trntmp.log, Trnnnnn.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb files to the new location.
  • Start the Microsoft Exchange Transport service

1 comment:

Robin M said...

You can do this with PowerShell now. See this article for more details