含內嵌工作負載的 XML 輸入檔範例 (DTA)
請複製利用 EventString 元素指定工作負載的這個 XML 輸入檔範例,再將它貼到您喜愛的 XML 編輯器或文字編輯器中。您可以利用 EventString 元素,在 XML 輸入檔中指定 Transact-SQL 指令碼工作負載,而不使用個別的工作負載檔案。將這個範例複製到編輯工具之後,請利用您的特定微調工作階段的各個值來取代指定給 Server、Database、Schema、Table、Workload、EventString 和 TuningOptions 等元素的值。如需有關可以搭配這些元素來使用的所有屬性和子元素的詳細資訊,請參閱<XML 輸入檔參考 (Database Engine Tuning Advisor)>。下列範例只用到部份可用的屬性及子元素選項。
程式碼
<?xml version="1.0" encoding="utf-16" ?>
<DTAXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://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 > 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>
註解
您可以在 EventString 元素所包含的內嵌工作負載中,指定 USE database_name 陳述式。