Udostępnij za pośrednictwem


Save Showplan XML Events Separately (SQL Server Profiler)

This topic describes how to save Showplan XML events that are captured in traces into separate .SQLPlan files by using SQL Server Profiler. You can open the Showplan XML event files in SQL Server Management Studio, which enables you to view the graphical execution plan for each event.

To save Showplan XML events separately

  1. On the File menu, click New Trace, and then connect to an instance of SQL Server.

    The Trace Propertiesdialog box appears.

    [!UWAGA]

    If Start tracing immediately after making connectionis selected, the Trace Propertiesdialog box fails to appear and the trace begins instead. To turn off this setting, on the Toolsmenu, click Options, and clear the Start tracing immediately after making connection check box.

  2. In the Trace Properties dialog box, type a name for the trace in the Trace name box.

  3. In the Use the template list, select a trace template on which to base the trace, or select Blank if you do not want to use a template.

  4. Do one of the following:

    • Select theSave to file check box to capture the trace to a file. Specify a value for Set maximum file size. Optionally, select the Enable file rollover and Server processes trace data check boxes.

    • Select theSave to table check box to capture the trace to a database table. Optionally click Set maximum rows, and specify a value.

  5. Optionally, select the Enable trace stop time check box, and specify a stop date and time.

  6. Click the Events Selectiontab.

  7. In the Eventsdata column, expand the Performanceevent category, and then select the Showplan XMLcheck box. If the Performance event category is not available, check Show all events to display it.

    The Events Extraction Settingstab is added to the Trace Propertiesdialog box.

  8. On the Events Extraction Settingstab, click Save XML Showplan events separately.

  9. In the Save As dialog box, enter the name of the file in which to store the Showplan XML events.

  10. Click All XML Showplan batches in a single file to save all Showplan XML events in a single XML file, or click Each XML Showplan batch in a distinct fileto create a new XML file for each Showplan XML event.

  11. To view the Showplan XML event file in SQL Server Management Studio, on the File menu, point to Open, and click File. Navigate to the directory where you saved the Showplan XML event file or files to select one and open it. Showplan XML event files have a .SQLPlan file extension.

Zobacz także

Koncepcje

Analyze Queries with SHOWPLAN Results in SQL Server Profiler