更改队列数据库位置Change the location of the queue database

Exchange Server 对队列消息存储使用可扩展存储引擎 (ESE) 数据库。Exchange Server uses an Extensible Storage Engine (ESE) database for queue message storage. 所有不同的队列都存储在一个 ESE 数据库中。All the different queues are stored in a single ESE database. 队列存在于 Exchange 邮箱服务器和边缘传输服务器上。Queues exist on Exchange Mailbox servers and Edge Transport servers. 有关队列的详细信息, 请参阅队列和队列中的邮件For more information about queues, see Queues and messages in queues.

队列数据库和队列数据库事务日志的位置由%ExchangeInstallPath%Bin\EdgeTransport.exe.config XML 应用程序配置文件中的键控制。The location of the queue database and the queue database transaction logs is controlled by keys in the %ExchangeInstallPath%Bin\EdgeTransport.exe.config XML application configuration file. 此文件与 Exchange 传输服务相关联。This file is associated with the Exchange Transport service. 下表对每个键进行了详细的说明。The following table explains each key in more detail.

按键Key 描述Description
QueueDatabasePathQueueDatabasePath
指定队列数据库文件的位置。Specifies the location of the queue database files. 这些文件是:The files are:
• mail.que• Mail.que
• trn.log• Trn.chk
默认位置为%ExchangeInstallPath%TransportRoles\data\QueueThe default location is %ExchangeInstallPath%TransportRoles\data\Queue.
QueueDatabaseLoggingPathQueueDatabaseLoggingPath
指定队列数据库事务日志文件的位置。Specifies the location of the queue database transaction log files. 这些文件是:The files are:
• trn.log• Trn.log
• trntmp.log• Trntmp.log
• trn.log nnn. log• Trn nnn.log
•处、。 trnres00001.jrs• Trnres00001.jrs
• trnres00002.jrs。 trnres00001.jrs• Trnres00002.jrs
• edb.log• Temp.edb
请注意, 在 Exchange 传输服务启动时, 将使用 schema.ini 来验证队列数据库架构。Note that Temp.edb is used to verify the queue database schema when the Exchange Transport service starts. 尽管不是事务日志文件, 但它将保留在与事务日志文件相同的位置。Although Temp.edb isn't a transaction log file, it's kept in the same location as the transaction log files.
默认位置为%ExchangeInstallPath%TransportRoles\data\QueueThe default location is %ExchangeInstallPath%TransportRoles\data\Queue.

在开始之前,您需要知道什么?What do you need to know before you begin?

  • 估计完成时间:15 分钟。Estimated time to complete: 15 minutes.

  • Exchange 权限不适用于本主题中的过程。Exchange permissions don't apply to the procedures in this topic. 这些过程在 Exchange Server 的操作系统中执行。These procedures are performed in the operating system of the Exchange server.

  • 当您停止或重新启动 Exchange 传输服务时, 服务器上的邮件流将被中断。When you stop or restart the Exchange Transport service, mail flow on the server is interrupted.

  • 当您更改队列数据库或事务日志的位置时, 不会移动现有队列数据库和事务日志文件。When you change the location of the queue database or the transaction logs, the existing queue database and transaction log files aren't moved. 新的队列数据库和新的事务日志是在新位置创建的。A new queue database and new transaction logs are created at the new location. 旧文件保留在旧位置, 但不再使用它们。The old files are left at the old location, but they're no longer used. 如果要在新位置重用旧队列数据库或事务日志文件, 则需要在 Exchange 传输服务停止时将这些文件移动到新位置。If you want to reuse the old queue database or transaction log files at the new location, you need to move the files to the new location while the Exchange Transport service is stopped.

  • 队列数据库和事务日志的文件夹需要以下权限:The folder for the queue database and transaction logs needs the following permissions:

    • 网络服务:完全控制Network Service: Full Control

    • 系统:完全控制System: Full Control

    • 管理员:完全控制Administrators: Full Control

      如果文件夹不存在, 但父文件夹具有这些权限, 则会自动创建新文件夹。If the folder doesn't exist, but the parent folder has these permissions, the new folder is created automatically.

  • 在 exchange XML 应用程序配置文件中 (例如, web.config 文件或 edgetransport.exe 文件) 上进行的任何自定义 exchange 或 Internet 信息服务器 (IIS) 设置都将被覆盖安装 Exchange CU。Any customized Exchange or Internet Information Server (IIS) settings that you made in Exchange XML application configuration files on the Exchange server (for example, web.config files or the EdgeTransport.exe.config file) will be overwritten when you install an Exchange CU. 请务必保存此信息, 以便在安装后可以轻松地重新应用这些设置。Be sure save this information so you can easily re-apply the settings after the install. 安装 Exchange CU 后, 需要重新配置这些设置。After you install the Exchange CU, you need to re-configure these settings.

  • 若要了解本主题中的过程可能适用的键盘快捷键,请参阅 Exchange 管理中心内的键盘快捷键For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts in the Exchange admin center.

  • 遇到问题?请访问以下 Exchange 论坛寻求帮助:Exchange ServerExchange OnlineExchange Online ProtectionHaving problems? Ask for help in the Exchange forums. Visit the forums at: Exchange Server, Exchange Online, or Exchange Online Protection.

使用命令提示符在新位置创建新队列数据库和事务日志Use the Command Prompt to create a new queue database and transaction logs in a new location

  1. 创建要在其中保存队列数据库和事务日志的文件夹。Create the folder where you want to keep the queue database and transaction logs. 请确保对该文件夹应用了正确的权限。Make sure that the correct permissions are applied to the folder.

  2. 在命令提示符窗口中,通过运行以下命令在记事本中打开 EdgeTransport.exe.config 文件:In a Command prompt window, open the EdgeTransport.exe.config file in Notepad by running the following command:

Notepad %ExchangeInstallPath%Bin\EdgeTransport.exe.config
  1. <appSettings>部分中查找和修改以下项。Find and modify the following keys in the <appSettings> section.
<add key="QueueDatabasePath" value="<LocalPath>" />
<add key="QueueDatabaseLoggingPath" value="<LocalPath>" />
<span data-ttu-id="e8e52-158">例如, 若要在 D:\Queue\QueueDB 中创建新的队列数据库和事务日志, 请使用以下值:</span><span class="sxs-lookup"><span data-stu-id="e8e52-158">For example, to create a new queue database and transaction logs in D:\Queue\QueueDB, use the following values:</span></span>
<add key="QueueDatabasePath" value="D:\Queue\QueueDB" />
<add key="QueueDatabaseLoggingPath" value="D:\Queue\QueueDB" />
<span data-ttu-id="e8e52-159">完成后, 保存并关闭 edgetransport.exe 文件。</span><span class="sxs-lookup"><span data-stu-id="e8e52-159">When you're finished, save and close the EdgeTransport.exe.config file.</span></span>
  1. 通过运行以下命令重新启动 Exchange 传输服务:Restart the Exchange Transport service by running the following command:
net stop MSExchangeTransport && net start MSExchangeTransport

如何判断是否生效?How do you know this worked?

若要验证是否已在新位置成功创建新的队列数据库和新的事务日志, 请执行以下步骤:To verify that you've successfully created a new queue database and new transaction logs in the new location, do these steps:

  1. 验证新位置处是否存在新的数据库文件 Mail.que 和 Trn.chk。Verify the new database files Mail.que and Trn.chk exist at the new location.

  2. 验证新位置处是否存在新的事务日志文件 Trn.log、Trntmp.log、Trnres00001.jrs、Trnres00002.jrs 和 Temp.edb 文件。Verify the new transaction log files Trn.log, Trntmp.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb files exist at the new location.

  3. 如果在 Exchange 传输服务启动后, 可以从旧位置删除旧队列数据库和事务日志文件, 则旧队列数据库将不再使用。If you can delete the old queue database and transaction log files from the old location after the Exchange Transport service has started, the old queue database is no longer being used.

使用命令提示符将现有队列数据库和事务日志移动到新位置Use the Command Prompt to move the existing queue database and transaction logs to a new location

备注

还有一个脚本可移动队列数据库和事务日志, 它可以在% ExchangeInstallPath% script 文件夹中找到, 也称为 Move-TransportDatabase。There is also a script to move the queue database and transaction logs, it can be found in the %ExchangeInstallPath%Scripts folder and it's called Move-TransportDatabase.ps1. 您必须指定以下参数: queueDatabasePath、queueDatabaseLoggingPath、iPFilterDatabasePath、iPFilterDatabaseLoggingPath 和 temporaryStoragePath。You have to specify the following parameters: queueDatabasePath, queueDatabaseLoggingPath, iPFilterDatabasePath, iPFilterDatabaseLoggingPath and temporaryStoragePath.

虽然您需要移动现有的队列数据库以保留其中任何未送达的邮件, 但通常不需要移动现有事务日志, 这是因为:Although you'll need to move the existing queue database to preserve any undelivered messages in it, you typically don't need to move the existing transaction logs because:

  • Exchange 传输服务的普通关闭会将所有未提交的事务日志条目写入队列数据库。An ordinary shutdown of the Exchange Transport service writes all uncommitted transaction log entries to the queue database.

  • 使用循环日志记录, 因此不会保留包含以前提交的数据库更改的事务日志。Circular logging is used, so transaction logs that contain previously committed database changes aren't preserved.

  1. 创建要在其中保存队列数据库和事务日志的文件夹。Create the folder where you want to keep the queue database and transaction logs. 请确保对该文件夹应用了正确的权限。Make sure that the correct permissions are applied to the folder.

  2. 在命令提示符窗口中,通过运行以下命令在记事本中打开 EdgeTransport.exe.config 文件:In a Command prompt window, open the EdgeTransport.exe.config file in Notepad by running the following command:

Notepad %ExchangeInstallPath%Bin\EdgeTransport.exe.config
  1. <appSettings>部分中查找和修改以下项:Find and modify the following keys in the <appSettings> section:
<add key="QueueDatabasePath" value="<LocalPath>" />
<add key="QueueDatabaseLoggingPath" value="<LocalPath>" />
<span data-ttu-id="e8e52-177">例如, 若要将队列数据库和事务日志的位置更改为 D:\Queue\QueueDB, 请使用以下值:</span><span class="sxs-lookup"><span data-stu-id="e8e52-177">For example, to change the location of the queue database and transaction logs to D:\Queue\QueueDB, use the following values:</span></span>
<add key="QueueDatabasePath" value="D:\Queue\QueueDB" />
<add key="QueueDatabaseLoggingPath" value="D:\Queue\QueueDB" />
<span data-ttu-id="e8e52-178">完成后, 保存并关闭 edgetransport.exe 文件。</span><span class="sxs-lookup"><span data-stu-id="e8e52-178">When you're finished, save and close the EdgeTransport.exe.config file.</span></span>
  1. 通过运行以下命令停止 Exchange 传输服务:Stop the Exchange Transport service by running the following command:
net stop MSExchangeTransport
  1. 将现有数据库文件 mail.que 和 trn.log 从旧位置移动到新位置。Move the existing database files Mail.que and Trn.chk from the old location to the new location.

  2. 将现有事务日志文件 Trn.log、Trntmp.log、Trn nnnnn.log、Trnres00001.jrs、Trnres00002.jrs 和 Temp.edb 从旧位置移动到新位置。Move the existing transaction log files Trn.log, Trntmp.log, Trn nnnnn.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb from the old location to the new location.

  3. 通过运行以下命令启动 Exchange 传输服务:Start the Exchange Transport service by running the following command:

net start MSExchangeTransport

如何判断是否生效?How do you know this worked?

若要验证是否已成功将现有队列数据库和事务日志移动到新位置, 请执行以下步骤:To verify that you've successfully moved the existing queue database and transaction logs to the new location, do these steps:

  1. 验证队列数据库文件 mail.que 和 trn.log 是否存在于新位置中。Verify the queue database files Mail.que and Trn.chk exist in the new location.

  2. 验证事务日志文件 trn.log、trntmp.log、处、和文件是否存在于新的位置中的文件。Verify the transaction log files Trn.log, Trntmp.log, Trnres00001.jrs, Trnres00002.jrs, and Temp.edb files exist in the new location.

  3. 验证旧位置中没有队列数据库或事务日志文件。Verify there are no queue database or transaction log files in the old location.