不能肯定的交易解析伺服器組態選項in-doubt xact resolution Server Configuration Option

適用於: 是SQL Server 否Azure SQL Database 否Azure Synapse Analytics (SQL DW) 否平行處理資料倉儲 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

使用 [不能肯定的交易解析] 選項,可控制 MicrosoftMicrosoft Distributed Transaction Coordinator (MS DTC) 無法解析之交易的預設結果。Use the in-doubt xact resolution option to control the default outcome of transactions that the MicrosoftMicrosoft Distributed Transaction Coordinator (MS DTC) is unable to resolve. 無法解析交易的原因,可能與 MS DTC 停機,或在復原時出現未知的交易結果等狀況有關。Inability to resolve transactions may be related to the MS DTC down time or an unknown transaction outcome at the time of recovery.

下表列出解析不確定的交易時,可能出現的結果值。The following table lists the possible outcome values for resolving an in-doubt transaction.

結果值Outcome value DescriptionDescription
00 無假設結果。No presumption. 如果 MS DTC 有無法解析的不確定交易,復原即會失敗。Recovery fails if MS DTC cannot resolve any in-doubt transactions.
11 假設為認可。Presume commit. 任何 MS DTC 不確定的交易都假設為已認可。Any MS DTC in-doubt transactions are presumed to have committed.
22 假設為中止。Presume abort. 任何 MS DTC 不確定的交易都假設為已中止。Any MS DTC in-doubt transactions are presumed to have aborted.

若要將停機時間降到最低,系統管理員可將此選項設為「假設為認可」或「假設為中止」,如以下範例所示。To minimize the possibility of extended down time, an administrator might choose to configure this option either to presume commit or presume abort, as shown in the following example.

sp_configure 'show advanced options', 1  
GO  
RECONFIGURE  
GO  
sp_configure 'in-doubt xact resolution', 2 -- presume abort  
GO  
RECONFIGURE  
GO  
sp_configure 'show advanced options', 0  
GO  
RECONFIGURE  
GO  
  

或者,系統管理員也可以採用預設值 (無假設結果) 並允許復原失敗,以便記錄 DTC 失敗,如以下範例所示。Alternatively, the administrator might want to leave the default (no presumption) and allow recovery to fail in order to be made aware of a DTC failure, as shown in the following example.

sp_configure 'show advanced options', 1  
GO  
RECONFIGURE  
GO  
sp_configure 'in-doubt xact resolution', 1 -- presume commit  
GO  
reconfigure  
GO  
ALTER DATABASE pubs SET ONLINE -- run recovery again  
GO  
sp_configure 'in-doubt xact resolution', 0 -- back to no assumptions  
GO  
sp_configure 'show advanced options', 0  
GO  
RECONFIGURE  
GO  
  

[不能肯定的交易解析] 選項屬於進階選項。The in-doubt xact resolution option is an advanced option. 如果您要使用 sp_configure 系統預存程序來變更此設定,只有在 [顯示進階選項] 設為 1 時,才能變更 [不能肯定的交易解析] 。If you are using the sp_configure system stored procedure to change the setting, you can change in-doubt xact resolution only when show advanced options is set to 1. 設定會立即生效,伺服器不必重新啟動。The setting takes effect immediately without a server restart.

注意

在與分散式交易相關的所有 MicrosoftMicrosoftSQL ServerSQL Server 執行個體上,讓此選項的組態都維持一致,將有助於避免資料不一致。Consistent configuration of this option across all MicrosoftMicrosoftSQL ServerSQL Server instances involved in any distributed transactions will help avoid data inconsistencies.

另請參閱See Also

RECONFIGURE (Transact-SQL) RECONFIGURE (Transact-SQL)
伺服器組態選項 (SQL Server) Server Configuration Options (SQL Server)
sp_configure (Transact-SQL)sp_configure (Transact-SQL)