重播跟踪数据Replay Trace Data

适用于: 是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: YesSQL Server NoAzure SQL Database NoAzure Synapse Analytics (SQL DW) NoParallel Data Warehouse

准备好输入跟踪数据之后,可以使用 MicrosoftMicrosoft SQL ServerSQL Server Distributed Replay 功能启动分布式重播。You can start a distributed replay with the MicrosoftMicrosoft SQL ServerSQL Server Distributed Replay feature after you have prepared the input trace data. 有关详细信息,请参阅 准备输入跟踪数据For more information, see Prepare the Input Trace Data.

使用管理工具 replay 选项启动分布式重播的事件重播阶段。Use the administration tool replay option to initiate the event replay stage of the distributed replay. 此阶段包含两个部分:跟踪数据调度和分布式重播的启动与同步。This stage consists of two parts: the trace data dispatch and the starting and synchronizing of the distributed replay.

分布式事件重播Distributed Event Replay

您可以以两种顺序模式之一重播跟踪数据:压力模式或同步模式。You can replay trace data in one of two sequencing modes: stress mode or synchronization mode. 默认行为是在压力模式下重播跟踪数据。The default behavior is to replay trace data in stress mode. 有关事件重播阶段和顺序模式的详细信息,请参阅 SQL Server Distributed ReplayFor more information about the event replay stage and sequencing modes, see SQL Server Distributed Replay

备注

输入跟踪数据必须在与分布式重播兼容的 SQL ServerSQL Server 版本中捕获。The input trace data must be captured in a version of SQL ServerSQL Server that is compatible with Distributed Replay. 输入跟踪数据还必须与要对其重播跟踪数据的目标服务器兼容。The input trace data must also be compatible with the target server that you want to replay the trace data against. 有关版本要求的详细信息,请参阅 Distributed Replay RequirementsFor more information about version requirements, see Distributed Replay Requirements.

重播跟踪To replay the trace

  1. (可选)修改重播配置设置:若要修改重播配置设置(如排序模式和各种缩放值),必须修改基于 XML 的重播配置文件 DReplay.exe.replay.config<ReplayOptions> 元素。(Optional) Modify replay configuration settings: If you want to modify the replay configuration settings, such as the sequencing mode and various scaling values, you must modify the <ReplayOptions> element of the XML-based replay configuration file DReplay.exe.replay.config. 还可以修改 <OutputOptions> 元素以指定输出设置,例如是否记录行计数。You can also modify the <OutputOptions> element to specify output settings, such as whether to record the row count. 如果要修改重播配置文件,建议您修改副本而非原始版本。If you modify the replay configuration file, we recommend that you modify a copy rather than the original. 若要修改设置,请执行以下步骤:To modify settings, follow these steps:

    1. 制作默认重播配置文件 DReplay.exe.replay.config的副本并重命名此新文件。Make a copy of the default replay configuration file, DReplay.exe.replay.config, and rename the new file. 默认重播配置文件位于管理工具安装文件夹中。The default replay configuration file is located in the administration tool installation folder.

    2. 在新的配置文件中修改重播配置设置。Modify the replay configuration settings in the new configuration file.

    3. 启动事件重播阶段(下一步)时,使用“重播”选项的 config_file 参数指定修改后的配置文件的位置。When initiating the event replay stage (the next step), use the config_file parameter of the replay option to specify the location of the modified configuration file.

    有关重播配置文件的详细信息,请参阅 配置分布式重播For more information about the replay configuration file, see Configure Distributed Replay.

  2. 启动事件重播阶段:若要启动分布式重播,必须使用 replay 选项运行管理工具。Initiate the event replay stage: To start the distributed replay, you must run the administration tool with the replay option. 有关详细信息,请参阅重播选项(分布式重播管理工具)For more information, see Replay Option (Distributed Replay Administration Tool).

    1. 打开 Windows 命令提示符实用工具 (CMD.exe),然后导航到 Distributed Replay 管理工具 (DReplay.exe) 的安装位置。Open the Windows Command Prompt utility (CMD.exe), and navigate to the installation location of the Distributed Replay administration tool (DReplay.exe).

    2. (可选)如果控制器服务不是在运行管理工具的计算机上运行,则使用 controller 参数 -m指定控制器。(Optional) Use the controller parameter, -m, to specify the controller, if the controller service is running on a computer different from the administration tool.

    3. 使用 controller_working_directory 参数 -d指定在预处理阶段,中间文件在控制器上的保存位置。Use the controller_working_directory parameter, -d, to specify where the intermediate file was saved on the controller during the preprocess stage.

    4. (可选)使用 -o 参数捕获每个客户端上结果跟踪文件中的重播活动。(Optional) Use the -o parameter to capture the replay activity in a result trace file on each client.

    5. (可选)使用 target_server 参数 -s指定分布式重播客户端应在其中重播跟踪工作负荷的 SQL ServerSQL Server 实例。(Optional) Use the target_server parameter, -s, to specify the instance of SQL ServerSQL Server where the distributed replay clients should replay the trace workload. 如果使用 <Server> 元素指定重播配置文件的 <ReplayOptions> 元素中的目标服务器,则此参数不是必需的。This parameter is not required if you used the <Server> element to specify the target server in the <ReplayOptions> element of the replay configuration file.

    6. 使用 clients 参数 -w指定应参与重播的分布式重播客户端。Use the clients parameter, -w, to specify the distributed replay clients that should participate in the replay. 列出客户端计算机名称,由逗号分隔。List the client computer names, separated by commas. 注意:不允许使用 IP 地址。Note: IP addresses are not allowed.

    7. (可选)使用 config_file 参数 -c指定重播配置文件的位置。(Optional) Use the config_file parameter, -c, to specify location of the replay configuration file. 如果您修改了默认重播配置文件的副本,则使用此参数来指向新的配置文件。Use this parameter to point to the new configuration file if you have modified a copy of the default replay configuration file.

    8. (可选)使用 status_interval 参数 -f指定是否希望管理工具以 30 秒之外的其他频率显示状态消息。(Optional) Use the status_interval parameter, -f, to specify if you want the administration tool to display status messages at a frequency other than 30 seconds.

    例如,下面的语法在控制器服务所在的同一计算机上启动重播阶段,使用位于 c:\WorkingDir的控制器工作目录,捕获每个参与客户端上的重播活动,使用客户端 client1client2 执行重播,并从位于 c:\modifiedreplay.config的经过修改的重播配置文件中获得其余的重播配置设置:For example, the following syntax initiates the replay stage on the same computer as the controller service, uses a controller working directory located at c:\WorkingDir, captures the replay activity on each participating client, uses clients client1 and client2 to perform the replay, and obtains the remaining replay configuration settings from a modified replay configuration file located at c:\modifiedreplay.config:

    dreplay replay -d c:\WorkingDir -o -w client1,client2 -c c:\modifiedreplay.config

  3. 完成分布式重播时,管理工具将返回摘要信息。When the distributed replay has finished, the administration tool returns summary information. 如果指定 -o 选项,则重播活动已保存在每个客户端上的结果跟踪文件中。If you specified the -o option, the replay activity has been saved in result trace files on each client. 有关结果跟踪文件的详细信息,请参阅 查看重播结果For more information about the result trace files, see Review the Replay Results.

另请参阅See Also

Distributed Replay Requirements Distributed Replay Requirements
管理工具命令行选项(Distributed Replay 实用工具) Administration Tool Command-line Options (Distributed Replay Utility)
配置 Distributed ReplayConfigure Distributed Replay