インライン ワークロードを使用した XML 入力ファイルのサンプル (DTA)

適用対象:SQL Server

この XML 入力ファイルのサンプルでは、ワークロードを EventString 要素を使用して指定しています。このサンプルをコピーして、お使いの XML エディターやテキスト エディターに貼り付けてください。 個別のワークロード ファイルを使用する代わりに、EventString 要素を使用して XML 入力ファイル内の Transact-SQL スクリプト ワークロードを指定することができます。 このサンプルを編集ツールにコピーした後に、 ServerDatabaseSchemaTableWorkloadEventString、および TuningOptions 要素で指定する値を、特定のチューニング セッションの値に置き換えてください。 これらの要素で使用できるすべての属性および子要素の詳細については、「XML 入力ファイル リファレンス (データベース エンジン チューニング アドバイザー)」を参照してください。 以下のサンプルでは、使用できる属性や子要素の一部だけを使用しています。

コード

<?xml version="1.0" encoding="utf-16" ?>
<DTAXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/sqlserver/2004/07/dta">
  <DTAInput>
    <Server>
      <Name>MyServerName</Name>
<!-- To tune multiple databases, list them and their associated tables in the following section. -->
      <Database>
        <Name>MyDatabaseName</Name>
        <Schema>
          <Name>MyDatabaseSchemaName</Name>
<!-- You can list as many tables as necessary in the following section. -->
          <Table>
            <Name>MyTableName1</Name>
          </Table>
          <Table>
            <Name>MyTableName2</Name>
          </Table>
        </Schema>
      </Database>
    </Server>
    <Workload>
<!-- The Weight attributes shown with the following EventString elements are optional. -->
      <EventString Weight="100.01">
        SELECT * FROM MyTableName1 WHERE
        MyColumnName1 &gt; 200
        ORDER BY ColumnName1
      </EventString>
      <EventString Weight="10.02">
        SELECT * FROM MyTableName2 WHERE
        MyColumnName2 BETWEEN 2 AND 25000
        ORDER BY ColumnName2
      </EventString>
    </Workload>
    <TuningOptions>
      <TuningTimeInMin>120</TuningTimeInMin>
      <StorageBoundInMB>1500</StorageBoundInMB>
      <FeatureSet>IDX</FeatureSet>
      <Partitioning>NONE</Partitioning>
      <KeepExisting>NONE</KeepExisting>
      <OnlineIndexOperation>OFF</OnlineIndexOperation>
<!-- The following tuning option specifies the first database to which the Database Engine Tuning Advisor connects when tuning the workload. This element is optional. -->
      <DatabaseToConnect>MyDatabaseName</DatabaseToConnect>
    </TuningOptions>
  </DTAInput>
</DTAXML>

説明

USE database_name ステートメントは、 EventString 要素に含まれるインライン ワークロードで指定できます。

参照