含使用者指定組態的 XML 輸入檔範例 (DTA)

適用於:SQL Server

請複製利用 Configuration 元素指定使用者指定組態的這個 XML 輸入檔範例,再將它貼到您喜愛的 XML 編輯器或文字編輯器中。 這可讓您進行「假設」分析。 「假設」分析包括利用 Configuration 元素來指定您要微調之資料庫的一組假設性實體設計結構。 之後,您再利用 Database Engine Tuning Advisor 來分析針對這個假設性組態來執行工作負載的效果,以了解它是否能夠改進查詢的處理效能。 這類分析的好處是既能夠評估新的組態,又免除了實際實作的負擔。 如果假設性組態所改進的效能不符需求,您很容易改變它,再分析它,直到產生的結果符合需求的組態出現為止。

將這個範例複製到編輯工具之後,請利用您的特定微調工作階段的各個值來取代指定給 ServerDatabaseSchemaTableWorkloadTuningOptionsConfiguration 等元素的值。 如需可以搭配這些元素來使用的所有屬性和子元素的詳細資訊,請參閱 XML 輸入檔參考 (Database Engine Tuning Advisor)。 下列範例只用到部份可用的屬性及子元素選項。

程式碼

<?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 following element specifies a workload file, which can be a trace file or a Transact-SQL script file. -->  
      <File>c:\PathToYourWorkloadFile</File>  
    </Workload>  
    <TuningOptions>  
      <TuningTimeInMin>180</TuningTimeInMin>  
      <StorageBoundInMB>10000</StorageBoundInMB>  
      <FeatureSet>IDX_IV</FeatureSet>  
      <Partitioning>NONE</Partitioning>  
      <KeepExisting>NONE</KeepExisting>  
      <OnlineIndexOperation>OFF</OnlineIndexOperation>  
    </TuningOptions>  
    <Configuration SpecificationMode="Absolute">  
      <Server>  
        <Name>MyServerName</Name>  
          <Database>  
            <Name>MyDatabaseName</Name>  
            <Schema>  
              <Name>MyDatabaseSchemaName</Name>  
                <Table>  
                  <Name>MyTableName1</Name>  
                  <Recommendation>  
                    <Create>  
                      <Index Clustered="true" Unique="false" Online="false" IndexSizeInMB="873.75">  
                        <Name>MyIndexName</Name>  
                        <Column Type="KeyColumn" SortOrder="Ascending">  
                          <Name>MyColumnName1</Name>  
                        </Column>  
                        <Filegroup>MyFileGroupName1</FileGroup>  
                      </Index>  
                    </Create>  
                  </Recommendation>  
                </Table>  
            </Schema>  
          </Database>  
      </Server>  
    </Configuration>  
  </DTAInput>  
</DTAXML>  

註解

  • 如果您指定了 Configuration 元素的 Absolute 模式 (Configuration SpecificationMode="Absolute"),便不支援卸除實體設計結構。

  • 您無法在Configuration 元素的任何一個模式 ( RelativeAbsolute ) 中,建立和卸除相同的實體設計結構。

另請參閱

啟動及使用 Database Engine Tuning Advisor
檢視及處理 Database Engine Tuning Advisor 的輸出
XML 輸入檔參考 (Database Engine Tuning Advisor)