Share via


How to Change the Location of the Queue Database

Microsoft Exchange Server 2007 will reach end of support on April 11, 2017. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.

 

Applies to: Exchange Server 2007, Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3

A queue is a temporary holding location for messages that are waiting to enter the next stage of processing. Each queue represents a logical set of messages that a transport server processes in a specific order.

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.

Before You Begin

To perform the following procedures, the account you use must be delegated the following:

  • Exchange Server Administrator role and local Administrators group for the target server

To perform the following procedures on a computer that has the Edge Transport server role installed, you must log on by using an account that is a member of the local Administrators group on that computer.

For more information about permissions, delegating roles, and the rights that are required to administer Microsoft Exchange Server 2007, see Permission Considerations.

Changing the Location of the Queue Database

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. You can use the following two methods to change the location of the queue database:

  • Use the Move-TransportDatabase.ps1 script

    Exchange 2007 Service Pack 1 (SP1) includes a new script that you can use to change the location of the Transport database files and transaction log files. This script also moves the database files to the new location that you specify. The following items are important to consider when you use the Move-TransportDatabase.ps1 script to move the database files:

    • If the destination drive differs from the source drive, sufficient space must be available on the destination drive. The script requires 2 gigabytes (GB) plus the space that is required to move the existing database file or transaction log files.

    • The QueueDatabasePath parameter cannot have the same value as the IPFilterDatabasePath parameter.

    • The QueueDatabaseLoggingPath parameter cannot have the same value as the IPFilterDatabaseLoggingPath parameter.

    • If the destination path does not exist, the script automatically creates the appropriate path.

    • The existing EdgeTransport.exe.config file is automatically saved as EdgeTransport.exe.config.yyyyMMddHHmmss.old

  • Manually move the database files

    Although we recommend that you use the Move-TransportDatabase.ps1 script to move the Transport database files, you can manually move the database files. The following list describes some important items to consider when you change the location of the queue database:

    • 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.

    • 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.

Moving the Queue Database to a New Location

To use the Move-TransportDatabase.ps1 script to move the queue database to a new location

  1. Start the Exchange Management Shell.

  2. At the shell prompt, run the following command. Replace <destination path> with an appropriate path, such as E:\Exchange\Transport\Queue.

    Move-TransportDatabase.ps1 -QueueDatabasePath: <destination path> 
    

Manually Creating a New Queue Database at a New Location

To create an new queue database at a new location

  1. Open the following file by using Notepad:

    C:\Program Files\Microsoft\Exchange Server\Bin\EdgeTransport.exe.config.

  2. Modify the following line in the <appSettings> section:

    <add key="QueueDatabasePath" value="<LocalPath>" />
    

    For example, to create a new location for your transaction logs at the location "C:\Queue\QueueDB", modify the QueueDatabasePath parameter as follows:

    <add key="QueueDatabasePath" value="C:\Queue\QueueDB" />
    
  3. Save and close the EdgeTransport.exe.config file.

  4. Restart the Microsoft Exchange Transport service.

  5. Verify that the new Mail.que and Trn.chk files are created at the new location.

  6. Remove the unused Mail.que and Trn.chk files from the original location.

Manually Reusing an Existing Queue Database at a New Location

To reuse an existing queue database at a new location

  1. Create the directory where you want to keep the queue database. Make sure that the correct permissions are applied to the directory.

  2. Open the following file by using Notepad: C:\Program Files\Microsoft\Exchange Server\Bin\EdgeTransport.exe.config.

  3. Modify the following line in the <appSettings> section:

    <add key="QueueDatabasePath" value="<LocalPath>" />
    

    For example, to change the location to "C:\Queue\QueueDB", modify the QueueDatabasePath parameter as follows:

    <add key="QueueDatabasePath" value="C:\Queue\QueueDB" />
    
  4. Save and close the EdgeTransport.exe.config file.

  5. Stop the Microsoft Exchange Transport service.

  6. Copy the files Mail.que and Trn.chk from the original location to the new location.

  7. Start the Microsoft Exchange Transport service.

  8. Remove the unused Mail.que and Trn.chk files from the original location.

Changing the Location of the Queue Database Transaction Logs

The location of the queue database transaction logs is controlled by the QueueDatabaseLoggingPath parameter in the EdgeTransport.exe.config application configuration file. You can use the following two methods to change the location of the transaction log files:

  • Use the Move-TransportDatabase.ps1 script.

    Exchange 2007 Service Pack 1 (SP1) includes a new script that you can use to change the location of the Transport database file and transaction log files. This script also moves the transaction log files to the new location that you specify. The following list describes some important items to consider when you use the Move-TransportDatabase.ps1 script to move the database files:

    • If the destination drive differs from the source drive, sufficient space must be available on the destination drive. The script requires 2 GB plus the space that is required to move the existing database file or transaction log files.

    • The QueueDatabasePath parameter cannot have the same value as the IPFilterDatabasePath parameter.

    • The QueueDatabaseLoggingPath parameter cannot have the same value as the IPFilterDatabaseLoggingPath parameter.

    • If the destination path does not exist, the script automatically creates the appropriate path.

    • The existing EdgeTransport.exe.config file is automatically saved as EdgeTransport.exe.config.yyyyMMddHHmmss.old

  • Manually move the database files

    Although we recommend that you use the Move-TransportDatabase.ps1 script to move the Transport transaction log files, you can also manually move the files.

    The following list describes some important points about how to change the location of the queue database transaction 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 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.

    Note

    Temp.edb is used to verify the queue database schema when the Microsoft Exchange Transport service starts. Although Temp.edb is not a transaction log file, it is kept in the same location as the transaction log files.

Moving the Transaction Log Files to a New Location

To use the Move-TransportDatabase.ps1 script to move the transaction log files to a new location

  1. Start the Exchange Management Shell.

  2. At the shell prompt, run the following command. Replace <destination path> with an appropriate path, such as E:\Exchange\Transport\Queue.

    Move-TransportDatabase.ps1 -QueueDatabaseLoggingPath: <destination path>
    

Manually Creating New Queue Transaction Logs at a New Location

To create new queue database transaction logs at a new location

  1. Open the following file by using Notepad:

    C:\Program Files\Microsoft\Exchange Server\Bin\EdgeTransport.exe.config.

  2. Modify the following line in the <appSettings> section:

    <add key="QueueDatabaseLoggingPath" value="<LocalPath>" />
    

    For example, to create a new queue database at the location "C:\Queue\QueueLogs," modify the QueueDatabaseLoggingPath parameter as follows:

    <add key="QueueDatabaseLoggingPath" value="C:\Queue\QueueLogs" />
    
  3. Save and close the EdgeTransport.exe.config file.

  4. Restart the Microsoft Exchange Transport service.

  5. Verify that the new Trn.log, Trntmp.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb files are created at the new location.

  6. Remove the unused Trn.log, Trntmp.log, Trnnnn.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb files from the original location.

Manually Reusing Existing Queue Transaction Logs at a New Location

Under ordinary circumstances, you should not have to reuse existing transaction logs at a new location. An ordinary shutdown of the Microsoft Exchange Transport service commits all uncommitted transaction log entries to the queue database. Circular logging is used. Therefore, transaction logs that contain previously committed database changes are not preserved. Only disaster recovery scenarios where the Microsoft Exchange Transport service wasn't shut down correctly or a hard disk drive failure would require that you restore and relocate an existing queue database and its existing transaction logs.

To reuse an existing queue database transaction logs at a new location

  1. Create the directory where you want to keep the queue database transaction logs. Make sure that the correct permissions are applied to the directory.

  2. Open the following file by using Notepad: C:\Program Files\Microsoft\Exchange Server\Bin\EdgeTransport.exe.config.

  3. Modify the following line in the <appSettings> section:

    <add key="QueueDatabaseLoggingPath" value="<LocalPath>" />
    

    For example, to change the location to "C:\Queue\QueueLogs", modify the QueueDatabaseLoggingPath parameter as follows:

    <add key="QueueDatabaseLoggingPath" value="C:\Queue\QueueLogs" />
    
  4. Save and close the EdgeTransport.exe.config file.

  5. Stop the Microsoft Exchange Transport service.

  6. Copy the existing Trn.log, Trntmp.log, Trnnnnn.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb files to the new location.

  7. Start the Microsoft Exchange Transport service.

  8. Remove the unused Trn.log, Trntmp.log, Trnnnnn.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb files from the original location.

For More Information

For more information about the queue database, see Managing the Queue Database.

By default the Move-TransportDatabase.ps1 script is located in the following folder on an Exchange 2007 SP1-based computer:

%ProgramFiles%\Microsoft\Exchange Server\Scripts

This script accepts the following parameters:

  • -QueueDatabasePath

  • -QueueDatabaseLoggingPath

  • -IPFilterDatabasePath

  • -IPFilterDatabaseLoggingPath

  • -TemporaryStoragePath

To move the Transport database or transaction log files, the script performs the following actions:

  1. The script validates the parameter values.

    • The script skips the validation action if the destination path that is specified is the same as the source path.

    • The QueueDatabasePath and IPFilterDatabasePath values cannot be the same. This is because both locations contain Trn.chk files.

    • The QueueDatabaseLoggingPath and the IPFilterDatabaseLoggingPath values cannot be the same. This is because the log files have the same file name.

    • The script verifies that 2 GB plus space equal to the size of the files that must be copied is available. For example, space must be available that is equal to 2 GB plus the size of the Mail.que, Trn.chk, and Ipfiltering.edb files.

    Note

    The script skips the file space verification if the destination path is on the same drive as the source files.

  2. The script creates folders, as appropriate.

    • The script creates the destination folders, if required.

    • If the Administrators group, the local System account, or the Network Services account does not have Full Control permissions to the destination path, the script adds the permissions.

    • If the Administrators group, the local System account, or the Network Services account has a Deny access rule to the destination path, the script generates a warning message. In this scenario, the script does not exit.

  3. The script stops the MSExchangeTransport service.

  4. The script backs up the EdgeTransport.exe.config file and names it EdgeTransport.exe.config.yyyyMMddHHmmss.old.

  5. The script moves the following files to the destination path, as appropriate for the command that was used:

    • QueueDatabasePath: Mail.que, Trn.chk

    • IPFilterDatabasePath: IPFiltering.edb, Trn.chk

    • Logging path: Trn*.log, Trnres00001.jrs, Trnres00002.jrs, Temp.edb

  6. The script updates the EdgeTransport.exe.config file and then saves the changes to the file.

  7. The script starts the MSExchangeTransport service.