共用方式為


處理物件 (XMLA)

在 Microsoft SQL Server SQL Server Analysis Services中,處理是將資料轉換成商務分析資訊的步驟或一系列步驟。 處理會因物件類型而異,但是處理永遠都是將資料轉換為資訊的一部分。

若要處理SQL Server Analysis Services物件,您可以使用Process命令。 Process命令可以在 SQL Server Analysis Services 實例上處理下列物件:

  • Cube

  • 資料庫

  • 維度

  • 量值群組

  • 採礦模型

  • 採礦結構

  • 資料分割

若要控制物件的處理, Process 命令具有可設定的各種屬性。 Process命令具有可控制的屬性:將執行多少處理、要處理哪些物件、是否要使用換行系結、如何處理錯誤,以及如何管理回寫資料表。

指定處理選項

Process命令的Type屬性會指定處理物件時要使用的處理選項。 如需處理選項的詳細資訊,請參閱 處理選項和設定 (Analysis Services)

下表列出 Type 屬性的常數,以及可使用每個常數處理的各種物件。

類型 適用的物件
ProcessFull Cube、資料庫、維度、量值群組、採礦模型、採礦結構、資料分割
ProcessAdd 維度、資料分割
ProcessUpdate 尺寸
ProcessIndexes 維度、Cube、量值群組,磁碟分割
ProcessData 維度、Cube、量值群組,磁碟分割
ProcessDefault Cube、資料庫、維度、量值群組、採礦模型、採礦結構、資料分割
ProcessClear Cube、資料庫、維度、量值群組、採礦模型、採礦結構、資料分割
ProcessStructure Cube、採礦結構
ProcessClearStructureOnly 採礦結構
ProcessScriptCache Cube

如需處理SQL Server Analysis Services物件的詳細資訊,請參閱處理多維度模型 (Analysis Services)

指定要處理的物件

Process命令的Object屬性包含要處理之物件的物件識別碼。 在 Process 命令中只能指定一個物件,但處理物件也會處理任何子物件。 例如,在 Cube 處理序中處理量值群組會處理該量值群組的所有資料分割,然而處理資料庫處理序則會處理資料庫包含的所有物件,包括 Cube、維度和採礦結構。

如果您將Process命令的ProcessAffectedObjects屬性設定為 true,也會處理受處理指定物件所影響的任何相關物件。 例如,如果使用 Process命令中的ProcessUpdate處理選項以累加方式更新維度,則如果ProcessAffectedObjects設定為 true,也會 SQL Server Analysis Services處理因為新增或刪除成員而使匯總失效的任何分割區。 在此情況下,單一Process命令可以在SQL Server Analysis Services 實例上處理多個物件,但SQL Server Analysis Services決定進程命令中指定的單一物件以外,也必須處理哪些物件。

不過,您可以使用Batch命令內的多個Process命令,同時處理多個物件,例如維度。 批次作業提供比使用ProcessAffectedObjects屬性更精細的SQL Server Analysis Services實例上物件的序列或平行處理控制層級,並可讓您針對較大的SQL Server Analysis Services資料庫微調處理方法。 如需執行批次作業的詳細資訊,請參閱 執行批次作業 (XMLA)

指定非正規繫結

如果Process命令不包含Batch命令,您可以選擇性地在Process命令的BindingsDataSource 和 DataSourceView屬性中指定離線系結,以便處理物件。 離線系結是資料來源、資料來源檢視和其他物件的參考,其中系結只在 Process 命令執行期間存在,並且會覆寫與正在處理之物件相關聯的任何現有系結。 如果未指定非正規 (out-of-line) 繫結,會使用與要處理的物件目前關聯的繫結。

非正規 (out-of-line) 繫結用於在下列情況:

  • 以累加方式處理資料分割,其中必須指定替代的事實資料表或是在現有事實資料表上的篩選,以確定不會計數資料列兩次。

  • 在 Microsoft SQL Server Integration Services 中使用資料流程工作,在處理維度、採礦模型或資料分割時提供資料。

非正規繫結 (out-of-line) 是以 Analysis Services 指令碼語言 (ASSL) 的一部分來描述。 如需 ASSL 中離線系結的詳細資訊,請參閱 資料來源和系結 (SSAS 多維度)

以累加方式更新資料分割

以累加方式更新已經處理的資料分割通常需要非正規繫結 (out-of-line),因為針對資料分割所指定的繫結,會參考已經在資料分割中彙總的事實資料表資料。 使用Process命令以累加方式更新已處理的資料分割時,SQL Server Analysis Services執行下列動作:

  • 建立一個與要以累加方式更新的資料分割有相同結構的暫存資料分割。

  • 使用 Process 命令中指定的離線系結來處理暫存資料分割。

  • 以現有選取的資料分割,合併暫存資料分割。

如需使用 XML 進行分析 (XMLA) 合併資料分割的詳細資訊,請參閱 合併資料分割 (XMLA)

處理在處理時發生的錯誤

Process命令的ErrorConfiguration屬性可讓您指定如何處理處理物件時遇到的錯誤。 例如,處理維度時,SQL Server Analysis Services在索引鍵屬性的索引鍵資料行中遇到重複的值。 因為屬性索引鍵必須是唯一的,所以SQL Server Analysis Services捨棄重複的記錄。 根據ErrorConfigurationKeyDuplicate屬性,SQL Server Analysis Services可以:

  • 忽略錯誤並繼續處理維度。

  • 傳回訊息,指出SQL Server Analysis Services發生重複的索引鍵並繼續處理。

ErrorConfigurationProcess命令期間提供選項有許多類似的條件。

管理回寫資料表

如果 Process 命令遇到已啟用寫入的資料分割,或這類資料分割的 Cube 或量值群組,該分割區尚未完全處理,則該分割區可能還沒有回寫資料表。 Process命令的WritebackTableCreation屬性會決定SQL Server Analysis Services是否應該建立回寫資料表。

範例

描述

下列範例會完整處理 Adventure Works DW 多維度 2012 範例SQL Server Analysis Services資料庫。

程式碼

<Process xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">  
  <Object>  
    <DatabaseID>Adventure Works DW Multidimensional 2012</DatabaseID>  
  </Object>  
  <Type>ProcessFull</Type>  
  <WriteBackTableCreation>UseExisting</WriteBackTableCreation>  
</Process>  

描述

下列範例會累加處理 Adventure Works DW 多維度 2012 範例SQL Server Analysis Services資料庫中Adventure Works DW Cube 之Internet Sales量值群組中的Internet_Sales_2004分割區。 Process命令會在 2006 年 12 月 31 日之後的 2006 年 12 月 31 日之後新增訂單日期的匯總至資料分割,方法是在Process命令的Bindings屬性中使用行外查詢系結,以擷取要從中產生匯總以新增至資料分割的事實資料表資料列。

程式碼

<Process ProcessAffectedObjects="true" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">  
  <Object>  
    <DatabaseID>Adventure Works DW Multidimensional 2012</DatabaseID>  
    <CubeID>Adventure Works DW</CubeID>  
    <MeasureGroupID>Fact Internet Sales 1</MeasureGroupID>  
    <PartitionID>Internet_Sales_2006</PartitionID>  
  </Object>  
  <Bindings>  
    <Binding>  
      <DatabaseID>Adventure Works DW Multidimensional 2012</DatabaseID>  
      <CubeID>Adventure Works DW</CubeID>  
      <MeasureGroupID>Fact Internet Sales 1</MeasureGroupID>  
      <PartitionID>Internet_Sales_2006</PartitionID>  
      <Source xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="QueryBinding">  
        <DataSourceID>Adventure Works DW</DataSourceID>  
        <QueryDefinition>  
          SELECT  
            [dbo].[FactInternetSales].[ProductKey],  
            [dbo].[FactInternetSales].[OrderDateKey],  
            [dbo].[FactInternetSales].[DueDateKey],  
            [dbo].[FactInternetSales].[ShipDateKey],   
            [dbo].[FactInternetSales].[CustomerKey],   
            [dbo].[FactInternetSales].[PromotionKey],  
            [dbo].[FactInternetSales].[CurrencyKey],  
            [dbo].[FactInternetSales].[SalesTerritoryKey],  
            [dbo].[FactInternetSales].[SalesOrderNumber],  
            [dbo].[FactInternetSales].[SalesOrderLineNumber],  
            [dbo].[FactInternetSales].[RevisionNumber],  
            [dbo].[FactInternetSales].[OrderQuantity],  
            [dbo].[FactInternetSales].[UnitPrice],  
            [dbo].[FactInternetSales].[ExtendedAmount],  
            [dbo].[FactInternetSales].[UnitPriceDiscountPct],  
            [dbo].[FactInternetSales].[DiscountAmount],  
            [dbo].[FactInternetSales].[ProductStandardCost],  
            [dbo].[FactInternetSales].[TotalProductCost],  
            [dbo].[FactInternetSales].[SalesAmount],  
            [dbo].[FactInternetSales].[TaxAmt],  
            [dbo].[FactInternetSales].[Freight],  
            [dbo].[FactInternetSales].[CarrierTrackingNumber],  
            [dbo].[FactInternetSales].[CustomerPONumber]  
          FROM [dbo].[FactInternetSales]  
          WHERE OrderDateKey > '1280'  
        </QueryDefinition>  
      </Source>  
    </Binding>  
  </Bindings>  
  <Type>ProcessAdd</Type>  
  <WriteBackTableCreation>UseExisting</WriteBackTableCreation>  
</Process>